目前该rowediting
插件提供了update/cancel
. 如果它是新添加的行,当我点击cancel
按钮时,我希望它不添加新行。
我怎样才能做到这一点?
这是FIDDLE。
目前,使用rowediting
,我只是添加和删除行。如果无法使用cancel
,如何添加新按钮close
并使其不添加行。
我也在看煎茶论坛,我发现了一个帖子,上面写着以下内容:
火灾事件
canceledit
何时
autoRecoverOnCancel
为真,如果记录是幻影,则将其删除
但是,这也不起作用。你能建议吗?
var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
clicksToMoveEditor: 1,
autoCancel: false,
});
tbar: [{
text: 'Add Employee',
iconCls: 'employee-add',
handler: function() {
rowEditing.cancelEdit();
// Create a model instance
var r = Ext.create('Employee', {
name: 'New Guy',
email: 'new@sencha-test.com',
start: new Date(),
salary: 50000,
active: true
});
store.insert(0, r);
rowEditing.startEdit(0, 0);
}
}, {
itemId: 'removeEmployee',
text: 'Remove Employee',
iconCls: 'employee-remove',
handler: function() {
var sm = grid.getSelectionModel();
rowEditing.cancelEdit();
store.remove(sm.getSelection());
if (store.getCount() > 0) {
sm.select(0);
}
},
disabled: true
}]