0

I have a view that contains 2 parts: + Part 1: an ADD button + Part 2: a container LIST that has scroll attribute is auto.

When user clicks on button ADD, the system will add a container to container LIST. User can add as much as they want.

But my container LIST has limit height so I want to scroll to new container that added to container LIST when user clicks ADD button. Anyone help me. Thanks

anh tran
  • 159
  • 2
  • 13

2 Answers2

3

I tried to use:

var scroller = pan.getScrollable().getScroller();
scroller.scrollToEnd(true);

But it's not working. Then I tried another way:

var scroller = pan.getScrollable().getScroller();
scroller.scrollTo(x,y,true);// y = 100000000000

It's work :)

anh tran
  • 159
  • 2
  • 13
  • At last i found you! Thanks! – BizApps Jan 29 '15 at 01:17
  • First I thought this is a really bad hack which I don't want to do. Then I tried the answer in http://stackoverflow.com/questions/6455413/scroller-scrollto-in-sencha-touch-dont-work-if-not-launched-manually-just-befor, but this also didn't work. After some more research in the Internet I finally gave up and ended up using your hack. Thanks for sharing. – Tobias Oct 19 '15 at 17:12
  • 1
    BTW, there could be another solution for this: https://www.sencha.com/forum/showthread.php?262467-Scroll-to-bottom-of-list-when-updated&p=1039640&viewfull=1#post1039640 But I didn't try it. – Tobias Oct 19 '15 at 17:13
1
var scroller = myListObject.getScrollable().getScroller();
scroller.scrollToEnd();
Murtuza
  • 308
  • 2
  • 14