PDA

View Full Version : change event not triggering in extjs4.1 using refs in controller



vijayakumar84
15 Apr 2013, 1:27 AM
change event not triggering in extjs4.1 using refs in controller.I have implemented following code .I have used combo box id cmbMarketRegion.can anybody correct me.If there is anything missing let me know



{
xtype:'combo',
id:'cmbMarketRegion',
minWidth:50,
minHeight:30,
displayField:'marketRegionName',
valueField:'marketRegionId'


}





{
ref: '#cmbMarketRegion',
}


],


init: function() {
this.control({
'cmbMarketRegion': {
change: 'valueChange'
}
});


},




valueChange:function(combo, ewVal, oldVal,optionsVal) {
alert("hai");
}

slemmon
16 Apr 2013, 2:40 PM
See if this works:



this.control({
'#cmbMarketRegion': {
change: 'valueChange'
}
});

mazhar.shaikh
16 Apr 2013, 4:14 PM
From memory I think,

proper definition of a ref is as such:


refs: [
{
ref: 'UpdateGrid',
selector: '#updatePicklistGrid'
}
],


I am using Sencha architect to create a ref to one of my grid on the view. The definition of your ref is slightly different. Its missing a selector. Sencha Architect creates a ref in this way by default.


Hope it helps

Thanks

vijayakumar84
18 Apr 2013, 1:02 AM
thanks slemmon ,mazhar.shaikh for reply can anybody tell what is selector how to use it

slemmon
18 Apr 2013, 2:20 PM
The syntax for refs can be found here:
http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.app.Controller-cfg-refs

The API doc shows how to set up both the ref and the selector portion of the refs config.