Results 1 to 8 of 8

Thread: scroll list to the top on refresh

  1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    45

    Default 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

    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

    Default

    Thank you Robert, it works flawless.

  4. #4

    Default 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 Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,255

    Default

    Probably either

    a) You haven't setup scrolling on your panel
    b) The panel isn't rendered yet
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  6. #6

    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 Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,255

    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);
        }
    });
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  8. #8

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •