View Full Version : Noob question: Best way to get/set scroll position of a panel

14 Jul 2010, 1:52 PM
I am new to Sencha and to Ext in general, and was having trouble tracking down in the documentation where I can get or set the scroll position of a vertical scrolling panel (or list for that matter).

Any help would be much appreciated.



14 Jul 2010, 3:04 PM
The documentation doesn't list anything useful, but reading through the source code, I found the answer.

There is a function in Scroller.js called "scrollTo" that does the trick. Sencha components appear to get a Ext.util.Scroller attached to them when they are set to be scrollable.

Anyway, for anyone interested, I hacked this quick and dirty function together. It seems to work:

function scrollTo(extComponent, x, y, animTime) {
// animTime is the animate Time in ms or an "animation config object"
extComponent.scroller.scrollTo({"x":x,"y":y},animTime, null); // The null means we use the default easing of "cubic-bezier(0.4, .75, 0.5, .95)"

15 Jul 2010, 10:38 AM
Good find. I'll make sure we doc this.