diff --git a/demo/js/case/combo/demo.text_value_combo.js b/demo/js/case/combo/demo.text_value_combo.js index 44847adae..15df83c54 100644 --- a/demo/js/case/combo/demo.text_value_combo.js +++ b/demo/js/case/combo/demo.text_value_combo.js @@ -190,9 +190,6 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, { items: [ { type: "bi.text_value_combo", - ref: function () { - combo2 = this; - }, width: 300, items: items, allowClear: true, diff --git a/src/case/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js index 7f726bd13..ac39d5158 100644 --- a/src/case/combo/textvaluecombo/combo.textvalue.js +++ b/src/case/combo/textvaluecombo/combo.textvalue.js @@ -85,11 +85,15 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { eventName: BI.TextValueComboPopup.EVENT_CHANGE, action: (...args) => { changeTag = true; - this.setValue(this.popup.getValue()); + const value = this.popup.getValue(); + this.setValue(value); if (o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) { this.combo.hideView(); this.fireEvent(BI.TextValueCombo.EVENT_CHANGE, ...args); } + if (o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_MULTI && BI.isEmptyArray(value)) { + this._clear(); + } } }, { eventName: BI.Controller.EVENT_CHANGE, @@ -165,7 +169,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { var vals = BI.isArray(v) ? v : [v]; - var result = BI.intersection(BI.map(this.options.items, (i, item) => item.value), vals); + var result = BI.intersection(BI.map(this.options.items, "value"), vals); if (result.length !== vals.length) { this.setStatus("error"); @@ -178,6 +182,10 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { this._clear(); }, + setText: function (text) { + this.trigger.setText(text); + }, + setValue: function (v) { this.combo.setValue(v); this._checkError(v); diff --git a/src/case/trigger/trigger.text.select.js b/src/case/trigger/trigger.text.select.js index cf1e2cdd9..b20b4f1b5 100644 --- a/src/case/trigger/trigger.text.select.js +++ b/src/case/trigger/trigger.text.select.js @@ -85,7 +85,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { setValue: function (val) { var formatText = this._digest(val, this.options.items); - this.trigger.setText(formatText); + this.setText(formatText); }, setTipType: function (v) {