1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    45
    Vote Rating
    0
    wakatanka is on a distinguished road

      0  

    Default scroll list to the top on refresh

    scroll list to the top on refresh


    Hi, i've a list dynamically populated from an ajax call and it work fine.
    There are only six rows visible, so when i have more than 6 i can scroll to the bottom , and here
    is the problem.
    If i scroll to the bottom of 20 rows, when i refresh the list with other data (3 rows for example) the
    list remain to the bottom and i don't see anything until i manually scroll to the top.
    Is there a way to avoid this?

    thanks so much

  2. #2
    Ext User
    Join Date
    Jul 2010
    Posts
    37
    Vote Rating
    0
    robertj98 is on a distinguished road

      0  

    Default


    After you do the code to refresh the list or store you can use

    Code:
            timeline.scroller.scrollTo({x: 0, y: 0}, true); // scroll to the top
    where timeline is the id of the list.

  3. #3
    Sencha User
    Join Date
    Jun 2010
    Posts
    45
    Vote Rating
    0
    wakatanka is on a distinguished road

      0  

    Default


    Thank you Robert, it works flawless.

  4. #4
    Ext User
    Join Date
    Aug 2010
    Posts
    9
    Vote Rating
    0
    FlorianArndt is on a distinguished road

      0  

    Default scroller is undefined

    scroller is undefined


    Hello there,

    when using Sencha Touch 0.93beta I get the error that the property scroller is undefined for both list and panel.
    What am I missing?

    Thanks in advance and for the great community support
    Florian

  5. #5
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,996
    Vote Rating
    649
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Probably either

    a) You haven't setup scrolling on your panel
    b) The panel isn't rendered yet
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  6. #6
    Ext User
    Join Date
    Aug 2010
    Posts
    9
    Vote Rating
    0
    FlorianArndt is on a distinguished road

      0  

    Default


    a) scrolling is set to 'vertical'
    b) the AJAX request triggering the alert is made well after the initial loading of the tabpanel I use
    Can you give me a simple example where is is used in a small demo application?

  7. #7
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,996
    Vote Rating
    649
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Code:
    Ext.setup({
        tabletStartupScreen: 'tablet_startup.png',
        phoneStartupScreen: 'phone_startup.png',
        icon: 'icon.png',
        glossOnIcon: false,
        
        onReady: function() {
            var html = [];
            for(var i = 0; i < 500; ++i){
                html.push('line ' + i);
            }
            
            var p = new Ext.Panel({
                fullscreen: true,
                scroll: 'vertical',
                html: html.join('<br />')
            });
            p.scroller.scrollTo({
                x: 0,
                y: 1000
            }, true);
        }
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  8. #8
    Ext User
    Join Date
    Aug 2010
    Posts
    9
    Vote Rating
    0
    FlorianArndt is on a distinguished road

      0  

    Default


    My mistake was somewhere else, but you still helped me figure it. Cheers!

Similar Threads

  1. Scroll top down for Panel like Tabpanel
    By tomalex0 in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 30 Jun 2010, 11:20 PM
  2. [CLOSED] [2.0.2] Pb in refresh top compoment
    By alacenaire in forum Ext GWT: Bugs (2.x)
    Replies: 1
    Last Post: 1 Oct 2009, 7:22 AM
  3. setting scroll top in grid
    By aseem_jain in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 17 Jun 2009, 1:51 AM
  4. TextArea Scroll to Top
    By DirtDog in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 1 Jun 2009, 11:09 AM

Thread Participants: 3