PDA

View Full Version : grid scrollOffset auto



emredagli
15 Sep 2009, 9:58 PM
Hii,
Is it possible to show scrolloffset space (and scroll) when it is required in the grid?
Since we can define autoExpandColumn so can be found space for scroll.

I hope it can be done. Because it is not good looking when there is a empty space on the right of the grid.

Thanks a lot.

Condor
15 Sep 2009, 11:46 PM
It's not that easy. There is no event when a scrollbar appears or disappears, so you have to add event handlers to everything that could cause a scrollbar to appear/disappear (all store events, row expander events etc.) and check if the scrollbar is visible and if the grid needs to be relayed out with or without a scrollOffset.

emredagli
16 Sep 2009, 1:03 AM
It's not that easy. There is no event when a scrollbar appears or disappears, so you have to add event handlers to everything that could cause a scrollbar to appear/disappear (all store events, row expander events etc.) and check if the scrollbar is visible and if the grid needs to be relayed out with or without a scrollOffset.

I see...
What about calculation of the height of the inner grid? If it exceeds the container height showing scrollOffset? And checking this control all load and add, remove events.
It is only an idea...

Thanks Condor.

Condor
16 Sep 2009, 2:15 AM
Yes, that would be the solution.

The problem is that Ext doesn't know all events that can cause a grid to change size (plugins, user extensions etc.).

emredagli
16 Sep 2009, 2:33 AM
Actually, I am not using such plugins. Only simple grid.

What do you think about this idea;
There is div inside the grid its class name is "x-grid3-body",
I plan to add "DOMSubtreeModified" event on its Element class. And when it is fired,
I will calculate the heigh and reconfigure the grid with scrollOffset...
(And also in container resize event)