PDA

View Full Version : Unset a value in multiselect combo



marxan
3 Sep 2012, 5:48 AM
Hello,

Is there a method to unselect a specific value of a multiselect combo.

In other words, I have a default value selected and when the user select another value, the default value should be unselected.

Thanks.

tvanzoelen
3 Sep 2012, 6:50 AM
What does getValue() returns an array? Then pop the default value out of that array and set the array again with setValue()



var values = combo.getValue();
//some code here to pop the unwanted values out

combo.setValue(values)

sword-it
4 Sep 2012, 11:19 PM
HI!

you may use clearValue() for your combo to clear default value.



yourCombo.clearValue();


check this for detailed information:-
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.ComboBox-method-clearValue

marxan
5 Sep 2012, 3:54 AM
The problem with getValue is that I get all the values selected in the combo however I only need the value that has been clicked.

Is there a method to do that, can't find it in the API.

Thanks

dawesi
5 Sep 2012, 3:55 AM
put multiSelect:false in your config

marxan
5 Sep 2012, 3:58 AM
but I need the multiselect: true.

What I want is to get the value that has been clicked and not all the value selected in the combo.

tvanzoelen
5 Sep 2012, 4:16 AM
That the last one in the list ;)

marxan
5 Sep 2012, 4:27 AM
Still a problem if I use the last value in the list. I also have to deselect a value. So it won't be in the list anymore and I don't know which value I have deselect.