You found a bug! We've classified it as EXTJSIV-8514 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    5
    Vote Rating
    0
    yamass is on a distinguished road

      0  

    Default bufferedrenderer throws Error when invoking grid.reconfigure

    bufferedrenderer throws Error when invoking grid.reconfigure


    Ext version tested:
    • Ext 4.2.0.265
    Browser versions tested against:
    • Chrome
    Description:
    • grid.reconfigure(newStore) does not work for grids with bufferedrenderer plugin.
    Steps to reproduce the problem:
    • try the example code
    • also try scrolling down before pressing the button
    • commenting out the bufferedrenderer plugin "fixes" the problem
    [B]
    [B]The result that was expected:
    • look at the behavior without the bufferedrenderer plugin. That's what I want. The grid has only 10 rows.
    [B]The result that occurs instead:
    • The grid has an arbitrary number of rows and scrolling back to top, I don't see any rows.
    [B]Test Case:

    Code:
    function createStore(numRecords) {
        var records = [];
        
        for (var i = 0; i < numRecords; i++) {
            records.push({
                name  : 'Lisa' + i,
                email : 'lisa@simpsons.com' + i,
                phone : '555-111-1224' + i
            });
        }
        
        return Ext.create('Ext.data.Store', {
            fields : ['name', 'email', 'phone'],
            data   : {
                items : records
            },
            proxy  : {
                type   : 'memory',
                reader : {
                    type : 'json',
                    root : 'items'
                }
            }
        });
    }
    
    var grid = Ext.create('Ext.grid.Panel', {
        title    : 'Simpsons',
        plugins  : 'bufferedrenderer',
        store    : createStore(1000),
        height   : 200,
        width    : 400,
        renderTo : Ext.getBody(),
        columns  : [
            { text : 'Name',  dataIndex : 'name' },
            { text : 'Email', dataIndex : 'email', flex : 1 },
            { text : 'Phone', dataIndex : 'phone' }
        ],
        tbar     : [
            {
                xtype   : 'button',
                text    : 'Reconfigure',
                handler : function () {
                    grid.reconfigure(createStore(10));
                }
            }
        ]
    });

    -----

    By the way: BufferedRenderer.getViewRange() will return undefined if the store has a cache miss. This leads to an error:
    Uncaught TypeError: Cannot read property 'length' of undefinedAbstractView.js:504

    Code:
    /*BufferedRenderer.js*/
    getViewRange: function() {
          var me = this,
              rows = me.view.all,
              store = me.store;
    
    
          if (store.data.getCount()) {
              return store.getRange(rows.startIndex, rows.startIndex + me.viewSize - 1); // may return undefined!
          } else {
              return [];
          }
      },

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,666
    Vote Rating
    435
    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


    Thanks for the report! I have opened a bug in our bug tracker.