0
votes

Change event is not triggering in extjs4.1 using refs in controller. I have implemented the following code. I have used combo box id cmbMarketRegion.

Can anybody correct me? If there is anything missing let me know.

This is my View combo box

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

In Controller

{
        ref: '#cmbMarketRegion',
}

  ], 

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

    }, 


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

Thanks

1

1 Answers

1
votes

You are searching for the xtype 'cmbMarketRegion', not id. Try something like this:

this.control({
    'combo[id="cmbMarketRegion"]': {
        change: this.valueChange,
        scope: this
    }
});

or, because id is unique:

this.control({
    '[id="cmbMarketRegion"]': {
        change: this.valueChange,
        scope: this
    }
});

Try to don't use id attribute, it's global.