我有一个启用了行编辑的网格。当我添加一行并调用 store.sync() 时,服务器会在该记录上生成某些字段,并在响应中返回完整的记录信息。然而,ExtJS 似乎并没有更新它的记录副本,除了 id。有没有办法让它做到这一点,还是我需要编写自定义代码?
这是网格控制器的摘录:
doneEdit: function (editor, e, eOpts) {
var me = this;
//
// Set up loading mask on grid during update (if record changed and is valid)
//
if (e.record.dirty && e.record.isValid()) {
e.grid.showUpdatingMask();
e.store.sync({
success: me.onSaveSuccess,
failure: me.onSaveFailure,
scope: me
});
}
else {
me.cancelEdit(editor, e, eOpts);
}
},
//
// onSaveSuccess() is only used for row editor grids
//
onSaveSuccess: function (batch, options) {
var me = this,
grid = me.getGrid();
grid.getStore().filter([]); // re-run whatever filters already exist, and sort.
grid.hideMask();
// update read-only active store if specified by sub-class
if(me.activeStore) {
// $TODO: handle load failure
me.activeStore.load();
}
},