PDA

View Full Version : Automatic Scrolling Grid



ethraza
15 May 2009, 2:18 PM
I'm trying to get a Grid to automatic scrool to the end, reload the store and start to scroll again in a loop.

On reload, the size of the view can change, so I need to know when the scroll reaches the end to reload.

To scroll, I'm currently thinking in do a grid.view.scroller.scrollTo('t', n+1, true) in a loop. But I don't know how to discovery if I reach the end.

If I scroll to the end and do a grid.view.scroller.getScroll(), it return an object with left and top. The top is what I need. So... There is a way to get this maximum top value without the need to scroll down to know that value?


Thanks 4 n help!

Animal
16 May 2009, 12:19 AM
Isn't it just a bit of arithmetic?

scrollHeight is the scrollable height. Subtract the element height from scrollHeight, and you get the value to scrollTo if you want to scroll to the end.

ethraza
16 May 2009, 8:58 AM
If someone else wants that:
grid.view.mainBody.getHeight() - grid.view.scroller.getHeight() = x.view.scroller.getScroll().top

Thanks!