您的位置:首页 > 其它

解决编辑时combobox显示编号而不是文本的问题

2012-09-18 22:18 344 查看
Ext.override(Ext.form.ComboBox, {
setValue: function (v) {

//////////为解决编辑时combobox显示编号的问题,而增加的代码
if (typeof this.store.url == 'string' && this.store.getCount() == 0) {
function setStoreValue() {
var value = this.getValue();
this.setValue(value);
}
this.store.on('load', setStoreValue, this, { single: true });
return;
}
//////////为解决编辑时combobox显示编号的问题,而增加的代码

var text = v;
if (this.valueField) {
var r = this.findRecord(this.valueField, v);
if (r) {
text = r.data[this.displayField];
} else if (Ext.isDefined(this.valueNotFoundText)) {
text = this.valueNotFoundText;
}
}
this.lastSelectionText = text;
if (this.hiddenField) {
this.hiddenField.value = Ext.value(v, '');
}
Ext.form.ComboBox.superclass.setValue.call(this, text);
this.value = v;
return this;
}
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐