1. #1
    Sencha User
    Join Date
    Mar 2007
    Posts
    22
    Vote Rating
    0
    barryglenn is on a distinguished road

      0  

    Default Unanswered: ListPaging is only paging one time

    Unanswered: ListPaging is only paging one time


    I'm trying to implement the ListPaging plugin in RC 2. It pages once, but only once. It looks to me like the plug-in method loadNextPage is setting a _loading flag to true in the beginning of the method but not setting it to false before it exits. If I add this.setLoading(false) to the last line of that method the ListPaging plugin will work as I expected, paging multiple times. I'm overwriting the nextPage method on the store because I need to load the records in manually and I'm wondering if that is what is causing the problem, but I can't find anywhere in the store source where it would be setting the _loading flag to false either. Here is my app.js code to reproduce. You will see it will page once for a total of four records, but then stop unless you make the change to the loadNextPage method. Thanks.

    Code:
    Ext.application({
      
      name: 'Scratch',
    
      viewport: {
        autoMaximize: true
      },
    
      launch: function(){
    
        window.itemIndex = 0;
    
        Ext.define('Scratch.store.Main', {
          
          extend: 'Ext.data.Store',
    
          config: {
            fields: ['name'],
            data: [
              { name: 'item ' + (window.itemIndex += 1) },
              { name: 'item ' + (window.itemIndex += 1) }
            ]
          },
     
          nextPage: function(){
            this.add( { name: 'item ' + (window.itemIndex += 1) } );
            this.add( { name: 'item ' + (window.itemIndex += 1) } );
          }
        });
    
        var view = Ext.create('Ext.List', {
    
          fullscreen: true,
          
          store: new Scratch.store.Main(),
          
          itemTpl: [
            '<div>{name}</div>',
          ],
    
          plugins: [
            {
              xclass: 'Ext.plugin.ListPaging',
              autoPaging: true
            }
          ]
    
        });
        Ext.Viewport.add(view);
        Ext.Viewport.setActiveItem(view);
      }
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,633
    Answers
    3452
    Vote Rating
    817
    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


    In the onStoreLoad method of ListPaging plugin it has the setLoading(false). This method fires when the load event from the Store is fired.
    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
    Nov 2012
    Posts
    14
    Vote Rating
    0
    pflopez is on a distinguished road

      0  

    Default


    I'm experiencing the same issue, the plugin calls for page 2 and then stops working.

    Mitchell, as you said onStoreLoad() sets this.setLoading(false).
    However, on loadNextPage() is setting setLoading(true):

    Code:
    loadNextPage: function() {
            var me = this;
            if (!me.storeFullyLoaded()) {
                me.setLoading(true);
                me.getList().getStore().nextPage({ addRecords: true });
            }
        }
    I've changed that to false, on that method and now seems to be working OK.
    Strange that most people are not running into this issue, so Probably I'm doing something wrong.

    FYI; this is my store nextPage method...

    Code:
       nextPage: function(options) {
            this.currentPage = this.currentPage +1 ;
            this.loadPage(this.currentPage);
        }

  4. #4
    Sencha User
    Join Date
    Nov 2012
    Posts
    14
    Vote Rating
    0
    pflopez is on a distinguished road

      0  

    Default


    After a little debugging the issue that I'm having is that ListPaging.onStoreLoad() is never called.

    Also, on a side note, although I see on the markup the loader and "load more", the container of those items has a display:none!important (regardless of autoLoading value)

  5. #5
    Sencha User
    Join Date
    Nov 2012
    Posts
    14
    Vote Rating
    0
    pflopez is on a distinguished road

      0  

    Default


    Found my error, I was overriding the load event from the store so the events where never fired.

    Sorry for the noise

Thread Participants: 2