Extjs 带有新记录的Store.sync()不会在响应中导入服务器生成的字段

Extjs 带有新记录的Store.sync()不会在响应中导入服务器生成的字段,extjs,extjs4,extjs4.1,Extjs,Extjs4,Extjs4.1,我有一个启用了行编辑的网格。当我添加一行并调用store.sync()时,服务器会在该记录上生成某些字段,并在响应中返回完整的记录信息。但是,ExtJS似乎不会更新记录的副本,除了id。有没有办法让它这样做,或者我需要编写自定义代码 这是电网控制器的摘录: doneEdit: function (editor, e, eOpts) { var me = this; // // Set up loading mask on grid during update (if

我有一个启用了行编辑的网格。当我添加一行并调用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();
    }
},
我也有同样的问题(Ext 4.2.1)。原因是我忘了在读卡器上设置idProperty默认值是“id”,我的是“_id”。Ext默默地更新记录失败,因为它无法识别匹配的id。现在它像一个符咒一样工作


因此,请确保响应符合读者期望的正确格式(root、idProperty、model definition等)

简而言之,它应该自动执行此操作。当我调用
store.sync()
时,它会用返回的数据更新整个记录,我会看看是否能找出区别。你能分享一下你的解决方案吗?@HDave:我现在不记得是什么解决了这个问题。有一种预感是服务器返回的内容可能有问题,并且/或者模型无法从响应中正确创建记录。请注意,ExtJS会自动忽略无法转换为模型的响应数据。您不会看到任何异常或其他错误。