在窗体面板中加载项时出现Extjs Uncaught TypeError

在窗体面板中加载项时出现Extjs Uncaught TypeError,extjs,extjs4,Extjs,Extjs4,我想将json数组中的一些表单项添加到表单面板中。但是我得到了一个错误“uncaughttypeerror:this.getView(…).getStore不是一个函数”。但是这个函数是在下面的控制器中声明的。我现在不知道怎么修理它 查看: Ext.define('myApp.viewForm', { extend: 'Ext.form.Panel', xtype: 'form', controller: "form, viewModel: { type: "form" },

我想将json数组中的一些表单项添加到表单面板中。但是我得到了一个错误“uncaughttypeerror:this.getView(…).getStore不是一个函数”。但是这个函数是在下面的控制器中声明的。我现在不知道怎么修理它

查看:

Ext.define('myApp.viewForm', {
extend: 'Ext.form.Panel',
 xtype: 'form',

controller: "form,

viewModel: {
    type: "form"   
},

title: 'form',
bodyPadding: 10,
autoScroll: true,

defaults: {
    anchor: '100%',
    labelWidth: 100
},

reconfigure: function(data) {                
    var me = this;
    Ext.each(data, function(item, index) {
        console.log(item) ;
        me.add(item);
    });
}
});

// create form and add store 
var form = Ext.create('myApp.view.Form', {
    renderTo: Ext.getBody(),
    store: new myApp.store.Forms()
});

// Mocking the loading of data and firing of 'metachange' event
var mockData = {
"data": [{
    "name": "ff",
    "xtype": "textfield",
    "allowBlank": false,
    "fieldLabel": "labelText1"
}, {
    "name": "fsdsdf",
    "xtype": "textfield",
    "allowBlank": false,
    "fieldLabel": "labelText2"
}]
};
form.getStore().fireEvent('metachange', form.getStore(), mockData);
控制器:

Ext.define('myApp.view.FormController', {
extend: 'Ext.app.ViewController',
alias: 'controller.form',

init: function(application) {
    this.getView().getStore().on("metachange", this.handleStoreMetaChange, this);
},

handleStoreMetaChange: function(store, meta) {
    this.getView().reconfigure(meta.data);
}
});

看起来像是extjs 5,而不是4。如果这是您正在使用的确切代码,那么它有语法问题-在line controller上缺少一个双引号:“form”。ViewController类是在extjs5中引入的