PDA

View Full Version : [CLOSED] keynav/pgdown on grid with buffered store



siq
30 Nov 2013, 2:33 AM
Hello,


if you scroll the records with "page down" key on a grid mapped to buffered store with large dataset, the navigation will block when the store starts to prune lru records.


you can check this bug on "infinite scroll example (http://docs.sencha.com/extjs/4.2.1/extjs-build/examples/grid/infinite-scroll.html)": select first row, then press "page down" without releasing it (or just press it repeatedly). The scrolling will block at the row 1000.


This is because the function Ext.selection.RowModel > onKeyPageDown will check the next idx to scroll by calling store.getCount(), which reports only the loaded data, not the total count.

https://fiddle.sencha.com/#fiddle/1t0

Until this will get fixed, i wrote this override, for temporary overcoming the problem:


Ext.override(Ext.selection.RowModel,{
onKeyPageDown: function (e) {
var me = this,
view = me.views[0],
rowsVisible = me.getRowsVisible(),
newIdx,
newRecord;


if (rowsVisible) {
// If rendering is buffered, we cannot just increment the row - the row may not be there
// We have to ask the BufferedRenderer to navigate to the target.
// And that may involve asynchronous I/O, so must postprocess in a callback.
if (view.bufferedRenderer) {
newIdx = Math.min(e.recordIndex + rowsVisible, me.store['get' + (me.store.buffered ? 'Total' : '') + 'Count']() - 1);//<- modified row
(me.lastKeyEvent || (me.lastKeyEvent = new Ext.EventObjectImpl())).setEvent(e.browserEvent);
view.bufferedRenderer.scrollTo(newIdx, false, me.afterBufferedScrollTo, me);
} else {
newRecord = view.walkRecs(e.record, rowsVisible);
me.afterKeyNavigate(e, newRecord);
}
}
}
});

Gary Schlosberg
30 Nov 2013, 8:48 AM
Thanks for the report! I have opened a bug in our bug tracker.