View Full Version : Grid with groupingFeature always scrolling to window top on expand or collapse group

18 Oct 2012, 6:36 AM
I have an issue currently with a grouping grid that is inside a Panel. The grid dynamically increases or decreases its heights depending on the data. All that works fine.

What is annoying is that every time a group is expanded or collapsed the window scrolls to the top if it is not already there.

The grouping feature in the extjs framework calls

if (preventSizeCalculation !== true) { view.refreshSize();


to recalculate the panel size but unfortunately when layouting is resumed the window scrolls.

How can I stop this? I see that grid view has a preserveScrollOnRefresh : true option but that doesnt work here since the scrollbar is the browsers window scrollbar and not some scrollbar inside the grid panel.

23 Oct 2012, 6:24 AM
The browser scrolls or the panel the grid is in?

23 Oct 2012, 7:08 AM
The browser, the grouping grid itself is in a Panel with auto layout that is nested in a container using hbox layout.

The Panel grows in height accordingly to the data in the grouping grid and when there is enough data the browser correctly renders a scrollbar.

But when I then scroll down a bit and expand or collapse a group the browser goes back to the top of the page.

in FF and IE

initial screenshot, scrollbar is not on top


after expanding a group, scrollbar moved up, you cant see it here but its up to the very top tof the browser the screenshot is cut off since I was not comfortable showing the entire in development app here but yes the browser window always scrolls up to the top of the page if it is not there already which is akward and requires the user to always scroll back down to the group that was just expanded or collapsed


13 Dec 2012, 4:08 AM
any update to this?

When I append
Ext.fly(document).on("scroll", function(){console.log("body scrolled");});

I can see that the document does indeed scroll top everytime a group is expanded or collapsed.

I tried as a workaround in the expand and collapse event to scrollIntoView with the native browser function and it works well in firefox but totally breaks the layout in IE.
When I try to use the Ext.Element scrollIntoView method however it does not work at all, it has no effect in either firefox or IE unless i debug it and set a breakpoint at the line. I am assuming that he does not execute it because it is already scrolling and it is not qeued?

Any idea for a workaround at least?