Results 1 to 4 of 4

Thread: Scrolling to on scrollend

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    72
    Vote Rating
    3
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,411
    Vote Rating
    1290
      0  

    Default

    Have you tried just using the ListPagingPlugin that is included in the framework?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,411
    Vote Rating
    1290
      0  

    Default

    Look at the source to see how it was achieved.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

Tags for this Thread

Posting Permissions

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