PDA

View Full Version : [UNKNOWN][3.??] ux/SelectBox fires select event twice



dolittle
8 Jan 2010, 3:55 PM
Hi,

I'm using Ext 3.1.0 FF 3.5.7

The SelectBox ux fires the select event twice.
To reproduce render it and add console.log('select') to the onSelect function in examples/ux/SelectBox.js

dolittle
8 Jan 2010, 4:21 PM
Fount the fix in http://www.extjs.com/forum/showthread.php?p=117889#post117889
Can you please update the ux/SelectBox.js with this code:

onSelect : function(record, index, skipCollapse){

// THIS ISEXPANDED CHECK IS NEW, THE REST IS UNCHANGED
// The authors implementation of this causes this method to be called twice,
// once while expanded, and again after closed.
// We only want this called once, so we check for expanded.
if (this.isExpanded()) {

if(this.fireEvent('beforeselect', this, record, index) !== false){
this.setValue(record.data[this.valueField || this.displayField]);
if( !skipCollapse ) {
this.collapse();
}
this.lastSelectedIndex = index + 1;
this.fireEvent('select', this, record, index);
}
}
},