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 如何解决此错误“UncaughtTypeError:无法调用未定义的方法'getForm'”_Extjs - Fatal编程技术网

Extjs 如何解决此错误“UncaughtTypeError:无法调用未定义的方法'getForm'”

Extjs 如何解决此错误“UncaughtTypeError:无法调用未定义的方法'getForm'”,extjs,Extjs,我试图在网格面板中添加编辑按钮功能。我想在“编辑”按钮上打开一个编辑窗口,使用Ext window表单更新网格行记录,该表单包含诸如班次名称、时间、总数、要求、备注等字段。窗口窗体已创建,但我在网格中选择的行值未在窗体字段中设置 我尝试使用以下代码: Ext.getCmp('shiftWindow').getForm().setValues(selection[0].data); 但它给出了以下错误 未捕获的TypeError:无法调用未定义的方法“getForm” 这是我的密码: var s

我试图在网格面板中添加编辑按钮功能。我想在“编辑”按钮上打开一个编辑窗口,使用Ext window表单更新网格行记录,该表单包含诸如班次名称、时间、总数、要求、备注等字段。窗口窗体已创建,但我在网格中选择的行值未在窗体字段中设置

我尝试使用以下代码:

Ext.getCmp('shiftWindow').getForm().setValues(selection[0].data);
但它给出了以下错误

未捕获的TypeError:无法调用未定义的方法“getForm”

这是我的密码:

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;
}
selection[0].data.ShiftName = selection[0].data.ShiftName.replace('(ARCHIVED)', '').trim(); //if edit Archive record then text name show without (ARCHIVED)

//shiftWindow.getForm().setValues(selection[0].data);
Ext.getCmp('shiftWindow').getForm().setValues(selection[0].data);
//Ext.getCmp('shiftWindow').setValue(selection[0].data);

shiftWindow.show();
窗口中没有getForm方法。您可以使用shiftWindow.down'form'获取表单。以下是片段:

shiftWindow.down'form'。form.setValuesselection[0]。数据