PDA

View Full Version : combo is not firing events



dancaescu
4 Jan 2012, 12:36 PM
Hi,

I have the following code:



var rowEditing = Ext.create('Ext.grid.plugin.RowEditing');
var grid = Ext.create('Ext.grid.Panel', {
renderTo: document.body,
region: 'center',
plugins: [rowEditing],
..................................................
columns: [{
header: 'Brand',
width: 100,
sortable: true,
dataIndex: 'brand',
field: {
xtype: 'combobox',
id: 'brand',
store: brands,
displayField: 'name',
valueField: 'id',
queryMode: 'local',
typeAhead: true,
forceSelection: true,
triggerAction: 'all',
viewConfig: {validateOnBlur: false},
selectOnFocus:true,
emptyText: 'Select brand'
},
listeners: {
select: { fn:function() { console.log('select from listener'); } },
scope: this
}



and, since the listener seems to not be able to pick up events, I added this:



Ext.override(Ext.form.ComboBox, {
select: function() {
this.fireEvent('select',this);
console.log('select from override');
}
});


Now it looks like on any change on my combo box I only see the message from the override, although my override is also firing the "select" event. Shouldn't I be able to catch the event in the listener?

Where is the mistake?

Thanks,
Dan

skirtle
4 Jan 2012, 2:10 PM
You've put the listener on the column, not the combobox.

dancaescu
5 Jan 2012, 5:59 AM
This worked, thanks!




width: 100,
sortable: true,
dataIndex: 'brand',
field: {
xtype: 'combobox',
id: 'brand',
store: brands,
displayField: 'name',
valueField: 'id',
queryMode: 'local',
typeAhead: true,
forceSelection: true,
triggerAction: 'all',
viewConfig: {validateOnBlur: false},
selectOnFocus:true,
emptyText: 'Select brand',
listeners: {
select: { fn:function() { console.log('select from listener'); } }, scope: this
}
},

Dan