admin管理员组文章数量:1123043
is it possible for combobox getValue() return object ?
my combobox store field contain ID, Code, Description1, description2
i wish to return ID , Description1. description2.
is it possible for combobox getValue() return object ?
my combobox store field contain ID, Code, Description1, description2
i wish to return ID , Description1. description2.
Share Improve this question asked 3 hours ago Charles CandyCharles Candy 111 bronze badge1 Answer
Reset to default 0Instead 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 (combobox, a, b) {
const value = this.callParent(),
hasValue = !Ext.isEmpty(value),
hasRecord = hasValue && this.getSelection();
return hasRecord && hasRecord.getData() || '';
}
});
本文标签: extjs combobox function getvalue() to return object contain multiple field valuesStack Overflow
版权声明:本文标题:extjs combobox function getvalue() to return object contain multiple field values - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736545630a1944442.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论