在控制器extjs4中查看引用
我无法在控制器中获取combobox值。combobox视图的getter方法返回在控制器extjs4中查看引用,extjs4,extjs-mvc,extjs4.2,Extjs4,Extjs Mvc,Extjs4.2,我无法在控制器中获取combobox值。combobox视图的getter方法返回 function i(){ return this.constructor.apply(this,arguments)||null } 而不是查看对象实例。如果我使用 var combo=this.getColumnTypeComboView().create() 然后我不获取combobox的选定值combo.getValue()要获取控制器中的视图引用,只需使用控制器类中的方法。要在视图和控制器
function i(){
return this.constructor.apply(this,arguments)||null
}
而不是查看对象实例。如果我使用
var combo=this.getColumnTypeComboView().create()
然后我不获取combobox的选定值
combo.getValue()
要获取控制器中的视图引用,只需使用控制器类中的方法。要在视图和控制器之间创建连接,请确保遵循MVC应用程序体系结构原则,如图所示
如果一个组合框是您的控制器负责的视图项,那么也可以使用控制器类中的方法
Ext.define('My.controller.Contact', {
extend: 'Ext.app.Controller',
views: ['Contact'],
init: function() {
//reference the view
var view = this.getView('Contact');
//reference the combobox change event
this.control({
'mywin combobox': {
change: this.onChangeContinent
}
});
},
onChangeContinent:function (field, value, options) {
//here you can get combobox component and its value
Ext.Msg.alert('Continent', value);
}
});
这是一个
编辑:
要从一个组件引用另一个组件,可以使用控制器方法,如下所示:
refs: [{
ref: 'combo',
selector: 'mywin combobox'
}]
谢谢你的回复。你能让我知道吗,在这个提琴例子中,我们如何在点击保存按钮时获得控制器中组合框的选定值..谢谢Devor。我使用的是getComboView,而不是getCombo。getter方法是使用'ref'值get+ref值(combo)=getCombo()生成的。干杯
refs: [{
ref: 'combo',
selector: 'mywin combobox'
}]