EvHaus / doby-grid

An HTML table element on steroids.
Other
14 stars 5 forks source link

Scrolling will jump when scrolled to bottom and selecting something #170

Open ckosmowski opened 9 years ago

ckosmowski commented 9 years ago

The Scrolling of the grid will jump if:

1.) The grid has a horizontal scrollbar 2.) The grid is scrolled all to the bottom 3.) An entry is selected in the grid

The scrolling will jump up exactly for the height of the horizontal scrollbar.

I think i found the problem already but i don't know how it can possibly be fixed.

Please see the Method updateRowCount():

if (th === 0 || scrollTop === 0) {
    page = offset = 0;
} else if (oldScrollTopInRange) {
    // maintain virtual position
    scrollTo(scrollTop + offset);
} else {
    // scroll to bottom
    scrollTo(th - viewportH);
}

In the very last case which applies here, scrollTo() is called.

Now if i look at scrollTo():

scrollTo = function (y) {
    y = Math.max(y, 0);
    y = Math.min(y, th - viewportH + (viewportHasHScroll ? window.scrollbarDimensions.height : 0));

    var oldOffset = offset;

i noticed that there already seems to be a fix for the above mentioned problem. But it does not apply because the passed value of y is always less than the result of the expression th - viewportH + (viewportHasHScroll ? window.scrollbarDimensions.height in this specific case.

EvHaus commented 9 years ago

I'm unable to reproduce this one. How do you execute step 3? Do you click on the grid somewhere?

ckosmowski commented 9 years ago

Yes on a row. But i use rowBasedSelection.