PDA

View Full Version : Grid - scrollTo bottom



Zdeno
4 Aug 2012, 4:41 PM
I found a lot of examples how to scroll to any row, but i didnt find the best time when i can call focus function.

1) When i use on load function on store, i need to use defer function with 500 because view will jump back to top. Even so i can see how the view jump from top to bottom.

2) Refresh event on view - same problem - without defer you can see how the view jump from top to bottom

Is there any better way how to scroll from top to bottom or better.. grid view will stay on bottom each time (question is how to do it) or is possible to apply any animation instead of that big jump?


tab.getView().focusRow(store.getCount()-1);

Cheers

sword-it
5 Aug 2012, 10:25 PM
Just use following to scroll to specific position of your choice



var scrollPosition = 100;
YourGrid.getEl().down('.x-grid-view').scroll('bottom', scrollPosition, true);


here,

'bottom' refers to side of scrolling, Either "l" (or "left"), "r" (or "right"), "t" (or "top", or "up"), "b" (or "bottom", or "down").
scrollPosition refers to position you want to scroll to
true is for animation of scrolling. you may also disableanimation certainly depends on your needs.
check this:-
http://docs.sencha.com/ext-js/3-4/#!/api/Ext.Element-method-scroll
also, you may checkout the following:-
http://docs.sencha.com/ext-js/3-4/#!/api/Ext.Element-method-scrollTo

(http://docs.sencha.com/ext-js/3-4/#!/api/Ext.Element-method-scroll)