JavaScript
Run Code
Open in Fiddle
Ext.create('Ext.data.Store', { storeId: 'testStore', fields:['char'], data: [ {char: 'a'}, {char: 'b'}, {char: 'c'}, {char: 'd'}, {char: 'e'}, {char: 'f'}, {char: 'g'} ] }); Ext.create('Ext.grid.Panel', { renderTo: Ext.getBody(), layout: 'fit', store: Ext.data.StoreManager.lookup('testStore'), columns: [ { dataIndex: 'char', text: 'Character', width: 50 }, { xtype: 'widgetcolumn', text: 'Widget', flex: 1, widget: { xtype: 'textfield', maxWidth: 100, readOnly: true, bind: { //hidden: '{recordIndex === 0}', value: '{recordIndex} - {record.char}' } } } ] }); Ext.defer(function() { Ext.getStore('testStore').removeAt(2); Ext.toast({ html: 'The row with character "c" was removed.' }); }, 1000); Ext.defer(function() { Ext.getStore('testStore').insert(0, {char: 'x'}); Ext.toast({ html: 'The row with character "x" was added.' }); }, 2000); /* // Bugfix: Ext.define('Ext.overrides.grid.RowContext', { override: 'Ext.grid.RowContext', setRecordIndex: function(index) { var me = this, viewModel = me.viewModel; me.recordIndex = index; if (viewModel) { viewModel.set('recordIndex', index); } } }); Ext.define('Ext.overrides.panel.Table', { override: 'Ext.panel.Table', onItemAdd: function(records, index, nodes, view) { var me = this, liveRowContexts = me.liveRowContexts, incr = records.length, i, len, recordId, context; if (liveRowContexts) { // If store is empty, the method is called twice. for (i = 0, len = records.length; i < len; ++i) { recordId = records[i].internalId; if (recordId in liveRowContexts) { --incr; } } if (incr) { for (recordId in liveRowContexts) { context = liveRowContexts[recordId]; if (context.recordIndex >= index) { context.setRecordIndex(context.recordIndex + incr); } } } } me.callParent(arguments); }, onItemRemove: function(records, index, nodes, view) { var me = this, liveRowContexts = me.liveRowContexts, decr = records.length, recordId, context; me.callParent(arguments); if (decr) { for (recordId in liveRowContexts) { context = liveRowContexts[recordId]; if (context.recordIndex >= index) { context.setRecordIndex(context.recordIndex - decr); } } } } }); */