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

来源:互联网 发布:网络数据抓取 编辑:程序博客网 时间:2024/06/06 04:26
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;    }});

原创粉丝点击