-
11 Feb 2013 1:02 AM #1
[4.1.1] Grid removeAt error
[4.1.1] Grid removeAt error
The test application:
1) click "fill grid"Code:Ext.onReady(function() { Ext.create('Ext.container.Viewport', { layout: 'border', items: [ { region: 'center', xtype: 'grid', id: 'grid', store: Ext.create('Ext.data.Store', { fields: [ {name: 'id', convert: null, defaultValue: undefined}, {name: 'title', convert: null, defaultValue: undefined} ] }), columns: [ { text: 'ID', dataIndex: 'id' }, { text: 'Title', dataIndex: 'title' } ] }, { region: 'north', xtype: 'buttongroup', items: [ { text: 'fill grid', handler: function () { var grid = Ext.getCmp('grid'), store = grid.getStore(); for (var i = 0; i <= 99; i++) store.add({id: i, title: 'title' + i}); } }, { text: 'del rows', handler: function () { var grid = Ext.getCmp('grid'), store = grid.getStore(); //store.suspendEvents(true); for (var i = 99; i >= 25; i--) store.removeAt(25); //store.resumeEvents(); } } ] } ] }); });
2) click "del rows"
3) no error
Now, uncomment "store.suspendEvents(true);" and "store.resumeEvents();"
1) reload page
2) click "fill grid"
3) click "del rows"
4) error "TypeError: records[i] is undefined"
-----
firefox 18.0.1
-
11 Feb 2013 3:18 AM #2
This is resolved in 4.2.0.
Also, it's fairly poor practice to do this. You would be better to just suspend the events without catching them and refresh the view.Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote