How to get the value of selected displayField in ExtJS 3.4 ComboBox? getValue() returns valueField, but I need other.
combo.getValue() -> the valueField
combo.getRawValue() -> the displayField
If this is the case,
displayField : 'countryName',
valueField : 'countryId',
then following function gives the required displayFiled (Even more than 1 fields are there in store you can get them too)
function getFieldValues(combo, nameIn, nameOut){
try{
var r = combo.getStore().find(nameIn,combo.getValue());
return combo.getStore().getAt(r).get(nameOut);
}
catch(err){
return'error';
}
}
Way to get the displayfield or any other filed which is in store :
var item = getFieldValues(Ext.getCmp('combo'), 'countryId', 'countryName');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With