PDA

View Full Version : ComboBox altering are the selected item when user click somewhere in the browser.



Hans Kejser Hansen
8 Jun 2011, 3:03 AM
I'm have a combobox, where some of of the item's have the same text. When the user choose an "same text"-item and the click somewhere else, then the first item with the text be choosed.

I can't do anything about the texts, because they're based om user input and are allowed to be the same.


var data =
[
[1, 'A1'],
[2, 'A2'],
[3, 'A3'],
[4, 'A4'],
[5, 'A4'],
[6, 'A4'],
[7, 'A5'],
[8, 'A6'],
[9, 'A7']
];

var store = new Ext.data.SimpleStore
({
fields:['aid', 'aname'],
data :data
});

var comboBox = new Ext.form.ComboBox
({
mode :'local',
hiddenName :'aid',
valueField :'aid',
displayField :'aname',
triggerAction:'all',
store :store
});

comboBox.render(document.body);

// Changes value after click outside the combobox.
setInterval(function() { console.log(+comboBox.getValue()); }, 500);


Hope anyone have a solution for this.

~Hans

skirtle
10 Jun 2011, 12:26 AM
Which ExtJS version are you using? I could reproduce your problem with 3.2.1 but it seems to have been fixed by 3.3.1.