1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    72
    Vote Rating
    3
    TDeBailleul is on a distinguished road

      0  

    Default Scrolling to on scrollend

    Scrolling to on scrollend


    Hi everyone,

    What I want is simple but I can't make it work. I have an Ext.List with 5 items in it. When I scroll to the end of that list, it load 5 more items and so on. After loading these new items, I want to scroll down to these news items.

    I tried the next code but it does not work. The alert return 0.
    But then, when I scroll the list again (not even to the end) it scrolls to these news items.

    Code:
    this.actuGrid = new Ext.List({
        	store: app.stores.actualites,
            grouped : false,
            itemTpl: app.templates.actualiteList,
            listeners: {
                scroller: {
                    scrollend: function(scroller, offset){                  
                        var currentNumberOfNews = parseInt(app.stores.actualites.getCount());
                        var nextNumberOfNews = currentNumberOfNews+app.newsPerLoad;
                        var newYPosition = currentNumberOfNews*70;
                        app.stores.actualites.load(
                            new Ext.data.Operation({
                                start:0,
                                limit:nextNumberOfNews
                            })
                        );
                        scroller.scrollTo({x:0,y:newYPosition});
                        alert(offset.y);
    
                    }
                }
            }
        });
    I hope somebody can tell me what is wrong with the code or what the problem is.

    Thank you

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Have you tried just using the ListPagingPlugin that is included in the framework?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    72
    Vote Rating
    3
    TDeBailleul is on a distinguished road

      0  

    Default


    No, I didn't try it yet because I wanted to use my own code. Plus I don't see what I'm doing wrong here, and I would like to understand why it doesn't work and not 'skip the problem'.

    But if nobody finds out what the problem is here, I'll give it a shot.

    Thanks

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Look at the source to see how it was achieved.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread