Hi,
I am trying to achieve the same goal (i.e. keeping the scroll position when the grid is refreshed). The store is automatically refreshed every 5 seconds (by an ajax call) with the function:
Code:
RealtimeStore.loadData(realdata);
This function does not fire the beforeload event, so I tried another way by monitoring the bodyscroll event of the grid panel with:
Code:
var realtimeGridState;
RealtimeGridPanel.on({
bodyscroll: function(){
if (RealtimeGridPanel.rendered) {
realtimeGridState = RealtimeGridPanel.getView().getScrollState();
console.log('Store ',realtimeGridState);
}
}
});
and reloading the scroll state on the store reloading (as explained in the previous posts):
Code:
RealtimeGridPanel.getStore().on({
load: function(){
if (realtimeGridState) {
RealtimeGridPanel.getView().restoreScroll(realtimeGridState);
console.log('Load ',realtimeGridState);
}
}
});
The realtimeGridState is well registered (log are correct), but no matter what, the scroll position is always reset to 0,0 when the grid is refreshed.
Any idea of what is happening?
Thank you!
NB: using ExtJS 3.4.1