Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs 如何在ext窗口中设置网格行getSelectionModel数据_Extjs - Fatal编程技术网

Extjs 如何在ext窗口中设置网格行getSelectionModel数据

Extjs 如何在ext窗口中设置网格行getSelectionModel数据,extjs,Extjs,我不想在ext窗口中设置行选数据,请给出解决方案。我的密码在这里 var shiftWindow = Ext.create('Ext.window.Window', { title: 'Edit Shift', resizable: false, id: 'shiftwindow', width: 465, //bodyPadding: 5, modal: true, store: shiftStorePlanner, items

我不想在ext窗口中设置行选数据,请给出解决方案。我的密码在这里

var shiftWindow = Ext.create('Ext.window.Window', {
    title: 'Edit Shift',
    resizable: false,
    id: 'shiftwindow',
    width: 465,
    //bodyPadding: 5,
    modal: true,
    store: shiftStorePlanner,

    items: {
        xtype: 'form',
        id: 'idFormShift',
        bodyPadding: 10,
        items: shiftViewModelPlannerData
    },
    buttons: [{
        text: 'Save',
        cls: 'planner-save-button',
        overCls: 'planner-save-button-over',
        handler: function() {
            var wi = this.up('.window')
            var form = Ext.getCmp('idFormShift');
            if (form.isValid()) {
                shiftTimemappingarray = [];
                getShiftTime();
                //this.up('.window').close();
            }
        }
    }, {
        text: 'Cancel',
        handler: function() {
            this.up('.window').close();
        }
    }]
});

    var host1 = Ext.getCmp('plannershifteditor');
    var selection = host1._shiftPlannerGrid.getSelectionModel().getSelection();
    if (selection.length === 0) {

        return;
    }

    Ext.getCmp('shiftWindow').getForm().setValues(selection[0].data);
    shiftWindow.show();
     }

根据您的ExtJS版本:

var selection = grid.getSelectionModel().getSelection();
grid.getForm().loadRecord(selection[0]);
稍后,您可以使用
updateRecord()
使用表单值更新模型

更多资讯:


extjs5及更高版本还支持viewmodel绑定。这将自动完成工作。

请将您的代码以小提琴的形式共享,它将帮助我们调试和分析问题。感谢您的回复。。。我只是想告诉你们,我的代码“Ext.getCmp('shiftWindow').getForm().setValues(selection[0].data);”行不起作用。我正在使用动态数据模型和存储以及网格的一些其他功能,所以我无法在fiddler中运行我的代码。请检查我收到问题的这一行…“Ext.getCmp('shiftWindow').getForm().setValues(选择[0])。‌​数据)”。如果我在窗口中对设置值使用了错误的属性,请建议我。您使用的是什么extJS版本。另外,您的问题也会更清楚一些。我们使用的是Ext版本:“4.2.1”