3
votes

I'm developing an extjs 6 application and recently figured out that it's not possible to set the value of a ComboBox using the setValue(value) method when its store doesn't contain a record with a valueFiled equals to value as described here http://docs.sencha.com/extjs/6.0/6.0.0-classic/#!/api/Ext.form.field.ComboBox-method-setValue.

So my question is is there any other way to change the value of the ComboBox when its store is empty (or doesn't contain a record with valueFiled equals to value) ?

2
Try the select() method.CD..
I don't understand... according to the doc select( combo, record, eOpts ) Fires when at least one list item is selected I don't have any element in my store (its empty) so is the list of items... moreover this method is not used to change valuehzitoun
I don't think the select() method (not event) will work, because in the code that method just calls setValue() internally. Why are you trying to set a value when there isn't a list of values to choose from? Maybe you can use the emptyText config to display a value when none is set?cpastore84
Actually it is an old functional behaviour that was developed with extjs 1 and I'm trying to migrate to version 6. In that version we could set any value to the comboBox regardless the state of the store. For emptyText it's not a solution because the value to set to the comboxBox changes depending on other value selected before...hzitoun

2 Answers

2
votes

You want setRawValue() instead of setValue()

1
votes

You figured it wrong. Please have a look at https://fiddle.sencha.com/#fiddle/12t4, where I got it to work without any problem.

Please check whether it is possible that you have set forceSelection: true on your combo, as this would induce the behaviour you described.