好的,看来您正在尝试获取视图:Group_prop
。确保此视图在其配置中有一个id
或最好是一个集合。itemId
例如
Ext.define('MyApp.view.GroupProb', {
extend: 'Ext.Panel',
alias: 'widget.group_prob',
config: {
...
itemId: 'groupProb',
...
},
....
});
现在在您的控制器中,您需要为此视图创建一个引用以正确访问它。所以你的控制器看起来像这样:
Ext.define('MyApp.controller.MyController', {
extend: 'Ext.app.Controller',
config: {
refs : {
groupProb : {
autoCreate: true,
selector: '#groupProb',
xtype: 'group_prob'
}
},
control: {
...
},
...
},
run_edit: function(data) {
$this = this;
this.mode = "update";
this.data = data;
this.win = this.getView('Group_prop').create();
var form = this.win.down('form');
var util = this.getController('controller_Helper');
form.getForm().loadRecord(data);
util.form_lock({
form:form,
items:['GROUP_KODE']
});
this.win.show();
},
...
});
现在从您的run_edit
函数来看,您似乎正在使用windows
变量this.win
(如果我错了,请纠正我)。在 Sencha Touch 中,您可以使用Panels
. 同样在此函数的末尾,您调用show
函数 on this.win
,这表明您要在显示run_edit
时执行this.win
。话虽如此,您可能希望您的run_edit
函数看起来像这样:
run_edit: function() {
var me = this,
mode = 'update',
data = data,
groupProbPanel = me.getGroupProb();
// This assumes that your form component has an itemId.
// You need one inorder use the down method.
var form = groupProbPanel.down('#form_itemId');
// You may want to double check this. I don't think that is how you
// you get the controller.
var util = this.getController('controller_Helper');
form.getForm().loadRecord(data);
util.form_lock({
form:form,
items:['GROUP_KODE']
});
}
由于我们希望在groupProbPanel
显示时发生这种情况,我们需要在我们的配置中设置一个显示事件监听器。control
所以你的控制器config
应该是这样的:
...,
config: {
refs : {
groupProb : {
autoCreate: true,
selector: '#groupProb',
xtype: 'group_prob'
}
},
control: {
groupProb : {
show: 'run_edit'
},
...
},
...
},
...