-
16 Sep 2010 7:52 PM #1
Reset list scroll position to top
Reset list scroll position to top
Hi there,
This may seem a silly question, but I just can't figure out how to reset a list's scroll position back to zero (top). I reload my list store dynamically and the new store often contains less elements than the previous one. The result is that if the first (longer) list happened to be scrolled a fair amount to the bottom, the new (shorter) list's elements cannot be seen upon loading the new store unless one scrolls all the way to the top by hand.
Your help is much appreciated.
Kind regards,
Jac
-
16 Sep 2010 7:58 PM #2
Code:list.scroller.scrollTo({ x: 0, y: 0 });Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
16 Sep 2010 8:02 PM #3
Thank you for the prompt reply
It works like a charm.
Cheers,
Jac
-
4 Sep 2011 7:39 AM #4
Hi, can you paste an example code starting from a List istantiation to show how and where to use the scrollTo() method? Thanks!
PS: I wrote a little entry in my blog to document an issue to List scrolling fixed whit the help of this thread! http://goo.gl/f7oVY.Follow my blog at: MovableApp.com!
http://twitter.com/#!/movableapp - My Sencha Touch Learning Experience
-
5 Dec 2011 2:53 PM #5
list.scroller does not work
list.scroller does not work
scroller is not a part of list, so list.scroller does not work. Please help
-
2 Jan 2012 2:13 AM #6
-
21 Jan 2012 4:49 PM #7
-
31 Jan 2012 10:22 PM #8
Code:Ext.override(Ext.DataView,{ refresh: function() { if (!this.rendered) { return; } this.fireEvent('beforerefresh', this); var el = this.getTargetEl(), records = this.store.getRange(); el.update(''); if (records.length < 1) { if (!this.deferEmptyText || this.hasSkippedEmptyText) { el.update(this.emptyText); } this.all.clear(); } else { this.tpl.overwrite(el, this.collectData(records, 0)); this.all.fill(Ext.query(this.itemSelector, el.dom)); this.updateIndexes(0); } this.hasSkippedEmptyText = true; if (this.scroller) { this.scroller.scrollTo({x:0, y:0}); } this.fireEvent('refresh', this); } });
Similar Threads
-
[OPEN] [FIXED-212] List not reducing scroll position after reload
By meyerovb in forum Sencha Touch 1.x: BugsReplies: 4Last Post: 31 Jan 2012, 10:34 PM -
scroll list to the top on refresh
By wakatanka in forum Sencha Touch 1.x: DiscussionReplies: 7Last Post: 9 Aug 2010, 4:49 AM -
How to move scroll bar position to the top after saving
By pearl_123 in forum Ext 2.x: Help & DiscussionReplies: 3Last Post: 11 Dec 2009, 8:09 AM -
Scroll scroll scroooolllll at a fixed position !!!
By j-mi-jim in forum Community DiscussionReplies: 0Last Post: 12 Feb 2009, 6:49 AM -
Open tab will reset scroll position when unfocused.
By mscifo in forum Ext 1.x: BugsReplies: 4Last Post: 7 Dec 2006, 11:03 AM


Reply With Quote
