Search code examples
sencha-touch-2scrollbarcontainers

auto scroll to the bottom of container in sencha touch 2


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


Solution

  • 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 :)