I am not able to get combobox value in a controller. The getter method of combobox view returns
function i(){
return this.constructor.apply(this,arguments)||null
}
instead of view object instance. If I use
var combo=this.getColumnTypeComboView().create()
then I don't get selected value of the combobox combo.getValue()
.
To get view reference in a controller simply use getView() method from the Controller class. To create a connection between view and a controller make sure that you follow MVC aplication architecture principals, found here
var view = this.getView('Contact'); //=> getView( name ) : Ext.Base
if a combobox is a item of a view that your controller is in charge off, then use control method also from Controller class.
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);
}
});
EDIT:
To reference one component from another, you can use Controller ref method, like this:
refs: [{
ref: 'combo',
selector: 'mywin combobox'
}]