JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://cdn.sencha.com/ext/gpl/4.2.0/resources/css/ext-all.css">
JavaScript
Ext.define('My.view.Contact', {
extend: 'Ext.window.Window',
alias: 'widget.mywin',
title: 'Contact',
renderTo: Ext.getBody(),
width: 300,
height:200,
items:[
{
xtype: 'combobox',
itemId: 'continent',
fieldLabel: 'My combo',
valueField: 'value',
queryMode: 'local',
store: new Ext.data.ArrayStore({
fields: ['value', 'text'],
data: [
[1, 'US'],
[2, 'Europe']
]
})
}
],
buttons: [
{
xtype: 'button',
text: 'Save',
action: 'save',
itemId: 'continentBtn'
}
]
});
Ext.define('My.controller.Contact', {
extend: 'Ext.app.Controller',
views: ['Contact'],
refs: [{
ref: 'combo',
selector: 'mywin combobox'
}],
init: function() {
//reference the view
var view = this.getView('Contact');
//reference the combobox change event
this.control({
'mywin combobox': {
change: this.onChangeContinent
},
'mywin button': {
click: this.onClickSaveBtn
}
});
},
onChangeContinent:function (field, value, options) {
//here you can get combobox component and his value
//Ext.Msg.alert('Continent', value);
},
onClickSaveBtn: function (field, value, options) {
var me = this;
combo = me.getCombo();
//combobox value calle from button
Ext.Msg.alert('Combo value', combo.getValue());
}
});
Ext.application({
name: 'My',
controllers: ['Contact'],
launch: function() {
Ext.create('My.view.Contact').show();
}
});