Scroller not triggering row renders when using keyboard
Scroller not triggering row renders when using keyboard
rewen
Posts: 74Questions: 2Answers: 0
Hi Allan,
I just noticed a potential bug in Scroller where if you do not first use the mouse to scroll the table and instead use the keyboard arrows or manual setting of scrollTop on the scrollBody then as the scroll coordinates seem to be allowed to surpass the boundary without triggering a redraw.
Once I scroll with the mouse then everything (including keyboard scrolling and setting scrollTop) starts to trigger rendering properly as the boundary is obeyed as expected.
Looking at the trace log I see lines like this:
Scroll: 1668px - boundaries: 0 / 990.5. Showing rows 52 to 77 in the viewport, with rows 0 to 80 rendered by the DataTable
Scroller seems aware that it should have re-rendered once the scroll value passed 990.5, but has ignored it.
I'm using Scroller 1.1.0 with DataTables 1.9.4.dev (also tested with 1.9.3 and 1.9.2).
Cheers,
Ryan
I just noticed a potential bug in Scroller where if you do not first use the mouse to scroll the table and instead use the keyboard arrows or manual setting of scrollTop on the scrollBody then as the scroll coordinates seem to be allowed to surpass the boundary without triggering a redraw.
Once I scroll with the mouse then everything (including keyboard scrolling and setting scrollTop) starts to trigger rendering properly as the boundary is obeyed as expected.
Looking at the trace log I see lines like this:
Scroll: 1668px - boundaries: 0 / 990.5. Showing rows 52 to 77 in the viewport, with rows 0 to 80 rendered by the DataTable
Scroller seems aware that it should have re-rendered once the scroll value passed 990.5, but has ignored it.
I'm using Scroller 1.1.0 with DataTables 1.9.4.dev (also tested with 1.9.3 and 1.9.2).
Cheers,
Ryan
This discussion has been closed.
Replies
After the first redraw the boundary is enforced properly.
I should also mention that I have sScrollY set to 500px but I am immediately changing that via JS to a size that fits the page better. I am doing this after I add my data (local JS array) like so:
// update datatables internal var
dom.table.fnSettings().oScroll.sY = h + 'px';
// adjust table css to match
scrollbody.height(h);
// ask scroller plugin to re-measure
dom.table.fnSettings().oScroller.fnMeasure(false);
I'm not sure why this sometimes happens.
Allan
In fact, this same thing happens in your example here, too: http://datatables.net/release-datatables/extras/Scroller/index.html
If you click on a row (anywhere in any visible row) and then hold the down arrow key, you will find that sometimes scrolling stops prematurely.
The first time it stopped at row 69 for me. After reloading it was row 46. Then 10, then 46 again. I'm not sure why the differences.
I just noticed that in your example, scrolling with the mouse doesn't fix keyboard scrolling like it does for mine.
In the example I have to keep clicking the table every so often as it gets stuck in order to continue keyboard scrolling.
In mine I only have to scroll or click once after it gets stuck and then it doesn't seem to get stuck again.
Not sure if that helps at all, lol, but it's an observation.