View Full Version : PagingScroller scrolls to top on refresh

14 Dec 2012, 3:03 AM
I have a problem the scroller for my gridpanel. I have application that will trigger a refresh of the grid after edit of a cell is comitted to the server (the server sends an updated version of the grid back and when those changes are applied the grid gets the refresh).

Anyway, when I have scrolled down the refresh will make my scroller go to the top.

I've spent quite some time to figure out why this happens (I have set the appropriate viewConfig).

I finally found the following rows of code in Ext.grid.PagingScroller:

onViewRefresh: function() {
if (store.getCount() === store.getTotalCount() || (store.isFiltered() && !store.remoteFilter)) {
me.position = viewDom.scrollTop = 0;


By removing the red line the scroll to top is gone.

I currently run 4.1.1 but I have verified that the code is the same in 4.1.3 (I can't upgrade to 4.1.3 due to other bugs).

The big question now is what type of bug this is. Are the above lines wrong, or is it me that use the code wrongly?

16 Dec 2012, 9:28 AM
This is probably due to if you are scrolled down and the store gets less records than what can be shown in your scroll then it needs to be scrolled up. Just my first thought.

18 Dec 2012, 1:38 AM
I agree that in your scenario resetting scroll would be the only reasonable solution. I can't really see how that can be the issue for me though. The reason my app hit's this code is that the store has loaded all records (it's 50 in my case). Why does the scroll need to be reset just because the store can load all available records?