PDA

View Full Version : How to detect if a combo value is from selection



filippo.ferrari
3 Oct 2013, 1:05 AM
Hi, I've a combox with force selection to false, I need two different actions if combo value comes from selection or not.

Any suggest?

Filippo

existdissolve
3 Oct 2013, 3:26 AM
A selection *must* exist in the store which is bound to the combobox, so you should be able to use the findRecordByValue() method of the combobox itself: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.field.ComboBox-method-findRecordByValue

If it returns a record, you know you've found a record in the combobox list's store that matches the current value of the combobox. If it returns false, you know you have a non-record bound value.

ettavolt
3 Oct 2013, 9:44 PM
Or simpler - check combo.valueModels.

filippo.ferrari
3 Oct 2013, 11:38 PM
A selection *must* exist in the store which is bound to the combobox, so you should be able to use the findRecordByValue() method of the combobox itself: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.field.ComboBox-method-findRecordByValue

If it returns a record, you know you've found a record in the combobox list's store that matches the current value of the combobox. If it returns false, you know you have a non-record bound value.

Perfect! Tanks