View Full Version : getting onchange of the ComboBox 'change' vs. 'select'

24 Apr 2007, 12:09 PM
I'm trying to use the Ext.form.ComboBox element to replace a select box but the ComboBox doesn't seem to provide the same level of event handling. That being on the old 'select' box in html I would connect to the 'onchange' event. It looks like the closest thing to this that the ComboBox has is 'select'.

My problem: the 'select' event is fired on mouse over of each item, I want to detect when someone clicks on an item in the combobox.

Am I missing something?


Using FF on Windows XP SP2 and ExtJS v1.0

Thanks for any help


24 Apr 2007, 12:52 PM
That's not correct. If you add the following to the combo example, the event will only fire when an item is clicked, not on mouseover.

combo.on('select', function() {alert('xx');});

24 Apr 2007, 2:35 PM
I hate to ask stupid questions but I can't seem to get the value of the ComboBox. From the code below I only get the "label" part, I dont get the "value" part.

new Ext.form.ComboBox({
id: 'charts_and_reports_combo',
store: new Ext.data.SimpleStore({
fields: ['value', 'label'],
data: [

['url1', 'Film Summary']
, ['url2', 'Flash Detail']
, ['url3', 'Top Ten/Top Ten']
displayField: 'label',
typeAhead: false,
mode: 'local',
emptyText: 'Charts & Reports',
selectOnFocus: true

var chartsAndReportsEl = Ext.get('charts_and_reports_combo');
var chartsAndReportsCurrentValue = chartsAndReportsEl.getValue();
if (chartsAndReportsEl) {
chartsAndReportsEl.on('select', function(o, record, index) {
if (this.getValue() != '' && this.getValue() != chartsAndReportsCurrentValue) {
chartsAndReportsCurrentValue = this.getValue();
alert('got selected: ' + this.getValue());

24 Apr 2007, 4:36 PM
add valueField:'value' to your config