更新编辑的行extjs

更新编辑的行extjs,extjs,extjs4,Extjs,Extjs4,我的问题对你来说很容易,但我负担不起。。 我从行中获取数据并显示在其他面板的字段中 我的目标是编辑这些数据并在网格中显示编辑后的数据,请给我一些建议,我知道它需要commit()函数但是 我的代码: var selModel = persongrid.getSelectionModel(); var selectedRecords = selModel.getSelection(); console.log(selectedRecords[0].data) me.activeRe

我的问题对你来说很容易,但我负担不起。。 我从行中获取数据并显示在其他面板的字段中 我的目标是编辑这些数据并在网格中显示编辑后的数据,请给我一些建议,我知道它需要
commit()函数
但是

我的代码:

   var selModel = persongrid.getSelectionModel();
  var selectedRecords = selModel.getSelection();

 console.log(selectedRecords[0].data)
 me.activeRecord = selectedRecords;

a=selectedRecords[0].data;
  var user = Ext.create('SFG.model.Person',a    );
 me.getForm().loadRecord(user);
但它需要继续,请帮助我。

应该这样做:

var selection = persongrid.getSelectionModel().getSelection(),
    record = selection.length > 0 ? selection[0] : null;

me.getForm().loadRecord(record);
完成所有编辑后,请调用

me.getForm().updateRecord();
这里有一个

注意,
updateRecord
执行以下操作

  • 召唤
  • 应用更改
  • 召唤

其中,
endEdit
还通知此实例绑定到的所有存储

不需要这么多努力,只需将编辑的值设置为记录并同步存储

将网格数据推送到表单是非常困难的

editUser: function(grid, record) {
        var view = Ext.widget('useredit');

        view.down('form').loadRecord(record);
    }
将编辑后的数据推回存储

updateUser: function(button) {
    var win    = button.up('window'),
        form   = win.down('form'),
        record = form.getRecord(),
        values = form.getValues();

    record.set(values);
    win.close();
    this.getUsersStore().sync();
}
注意:getUsersStore()的结构与getStore相同

请浏览下面的链接,这可能对您的要求有用。此链接包含您需要的完整代码以及解释

http://docs.sencha.com/extjs/4.0.7/#!/guide/application_architecture

谢谢。

您的网格使用其他模型?不是“SFG.model.Person”?