PDA

View Full Version : ComboBox Select Listener



dcawley
10 May 2010, 2:54 PM
I'm trying to add a select listener to a combo box like this:


new Ext.form.ComboBox(
{
typeAhead: true,
mode: 'local',
selectOnFocus: true,
triggerAction: 'all',
displayField: 'description',
valueField: 'origin',
store: Exs.Data.storeOrigins,
listeners:
{
select: function (cmb, record, index)
{
alert("index: " + index);
}
}
}),The listener function is invoked but the arguments passed to the listener function (cmb, record, index) are always undefined. I also tried using the addListener method with the same results. From the documentation I would expect those three arguments to be passed to my listener function:

select : ( Ext.form.ComboBox combo, Ext.data.Record record, Number index ) So What is it I am doing wrong?

13 May 2010, 4:45 AM
it works for me:



var combo = new Ext.form.ComboBox({
store : ['1','2','3'],
listeners : {
select : function() {
console.log(arguments);
}
}

});

new Ext.Window({
height : 100,
width : 200,
items : combo
}).show()

Oh, and you should google firebug. Developing with alerts is so inefficient