正在检测何时将新行添加到网格[EXTJS]



我目前正在处理一个使用ExtJS 4的项目。由于我找不到这个问题的任何解决方案,我想知道:

如何检测何时将行添加到网格中?

一些解决方案说我应该在网格上工作,而另一些则建议在商店上工作。我曾尝试在商店中使用datachanged和rowit事件,但没有任何更改。

谢谢

您可以监听绑定到gridadd事件store

在那里,如果您添加了网格,但没有与服务器同步,您会发现网格上有新行。

请参阅下面的示例

Ext.define('Admin.view.credit.Grid', {
extend: 'Ext.grid.Panel',
xtype: 'credit-grid',
store: 'creditStore'
listeners: {
boxready: function(){
var me =this;
me.getStore().on('add',Ext.bind(me.onAddLines,me));
}
},
onAddLines: function(store, records, index, eOpts){
console.log('New Records Added');
console.log(records);
},
rowLines: false,
scrollable: false,
columns: [{
dataIndex: 'id',
text: 'Id',
flex: 0.5,
sortable: false,
groupable: false,
hideable: false
}]
});

添加事件文档

最新更新