1. #1
    Sencha Premium Member ethraza's Avatar
    Join Date
    Jun 2007
    Location
    Brazil
    Posts
    362
    Vote Rating
    3
    ethraza is on a distinguished road

      0  

    Question Automatic Scrolling Grid

    Automatic Scrolling Grid


    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!
    LAMPE (Linux / Apache / MySQL / PHP / ExtJs)

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    62
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    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.

  3. #3
    Sencha Premium Member ethraza's Avatar
    Join Date
    Jun 2007
    Location
    Brazil
    Posts
    362
    Vote Rating
    3
    ethraza is on a distinguished road

      0  

    Default


    If someone else wants that:
    grid.view.mainBody.getHeight() - grid.view.scroller.getHeight() = x.view.scroller.getScroll().top

    Thanks!
    LAMPE (Linux / Apache / MySQL / PHP / ExtJs)

Thread Participants: 1