1. #1
    Sencha User
    Join Date
    Mar 2007
    Posts
    20
    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
    St. Louis, MO
    Posts
    34,085
    Vote Rating
    453
    Answers
    3153
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      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
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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