PDA

View Full Version : 4.1.1 - How to setValue of a comboBox with multiSelect: true ?



Dafram
23 Jul 2012, 12:35 AM
Hi!

How can I set the value of a combobox with multiSelect = true?

my code (working in ExtJs 4.0.7) doesn't work in 4.1.1:


var cbCaratteristica = Ext.create('Ext.form.field.ComboBox', {
name: 'cbCaratteristica',
id: 'id_cbCaratteristica',
fieldLabel: 'Caratteristica',
displayField: 'cadesc',
valueField: 'idcara',
width: 450,
labelWidth: 100,
store: storeCaratteristica,
queryMode: 'local',
allowBlank: false,
forceSelection: true,
multiSelect: true
});

...

function setValCbCaratteristica()
{
var_caratteristica = "1,2"; // the same with "1, 2"
cbCaratteristica.reset();
cbCaratteristica.setValue(var_caratteristica);
}

My example: http://www.electricblueskies.com/smeraldo/es03.html

Dafram
23 Jul 2012, 5:19 AM
NB: displayField is different from valueField.

I try to set value using value field...

Any suggestion?

vietits
23 Jul 2012, 5:34 AM
Try to use array of values instead of string.


var_caratteristica = [1, 2];
cbCaratteristica.reset();
cbCaratteristica.setValue(var_caratteristica);

Dafram
23 Jul 2012, 6:17 AM
I found a thing.

For combobox ["1","2"] is different from [1,2]