is it possible for combobox getValue() return object ?
my combobox store field contain ID, Code, Description1, description2
i wish to return ID , Description1. description2.
Instead of using combobox.getValue()
you might want to use combobox.getSelection().getData()
.
The selection model returns the full record.
If you have to use getValue(), you have to create a custom combobox.
Remember, that this used in a lot of places out of the box, like the form.getValues()
. Means: this needs more testing!!!
If you always want to use this, create an override.
/**
* @return {Object|''}
*/
Ext.define('ValueCombobox', {
extend: 'Ext.field.ComboBox',
xtype : 'valuecombobox',
getValue: function () {
const value = this.callParent(),
hasValue = !Ext.isEmpty(value),
hasRecord = hasValue && this.getSelection();
return hasRecord && hasRecord.getData() || '';
}
});