PDA

View Full Version : How to move the vertical scrollbar to the current position + n for example



just_a_kid
10 Nov 2010, 9:05 AM
Hi I am using TreeGrid with autoScroll property

There is basically the situation as below
1. there are lot of tree node with sub nodes which can be expanded and collapsed within the limited height
2. when there is an overflow , the vertical scrollbar will be created automatically which is correct

3. However there is some thing as below that i want to address
- You expand some of the child nodes in three until the scrollbar appears
- Then you scrollbar to the very bottom and expand that node
- The node is expanded but the scrollbar position is remain the same ( and you don't see the child node that is expanded )
- In this situation you need to scroll again to very bottom to see all the results


I am thinking some improvements as below
1. As soon you expand the node and you render it
i will do this

this.dom.scroller.scrollTop = this.dom.scroller.scrollTop+50;
In order to make visible area for the child nodes that just being expanded ( at least the first child node )


However i am getting difficulty at which event i need to do this

I just did in "load" event in TreeLoader as below
1. in "load" event of treeLoader i recalculcate the scrollTop , then i put an alert statement to see whether the scroller is moving
2. it works , i can see the scroller moves to current position + n positionn
3. the problem seems this is done before the child nodes is rendered therefore i can't see the child nodes
4. another thing , the scoller seems to recalculate again itself ( maybes it's done internally in extjs ) after the child nodes is rendered.

Anybody has done this before / can give me some examples on how to do this ?

Thanks