PDA

View Full Version : get Ingex value of a combobox



bourasrafik
9 Jul 2010, 8:27 AM
Hi,
does any one have an idea how to get the index of the item selected in a combobox, I know that there is two methods for getting the value(getValue() and getRawValue()) but because the text inside could be in different language depending of the configuration, I need to get the index(first item selected=0, second item selected=0, .. ) instead.

any idea?

Regards,

Rafik

fay
9 Jul 2010, 9:08 AM
myCombo.view.getSelectedIndexes()[0] (myCombo.selectedIndex might work), or keep track of it yourself via the select event.

Condor
9 Jul 2010, 11:24 PM
No, that only works if the item was selected from the list, but not when the value was typed or still the initial value.

Use:

var record = combobox.findRecord(combobox.valueField || combobox.displayField, combobox.getValue());
var index = combobox.store.indexOf(record);