diff --git a/demo/js/case/combo/demo.text_value_combo.js b/demo/js/case/combo/demo.text_value_combo.js index 50e3fea43..44847adae 100644 --- a/demo/js/case/combo/demo.text_value_combo.js +++ b/demo/js/case/combo/demo.text_value_combo.js @@ -146,7 +146,7 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, { type: "bi.button", text: "setValue(1)", handler: function () { - combo1.setValue(); + combo1.setValue(1); }, }, vgap: 10, @@ -184,6 +184,30 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, { vgap: 10, } ] + }), + this.createCombo("支持复选", { + type: "bi.vertical", + items: [ + { + type: "bi.text_value_combo", + ref: function () { + combo2 = this; + }, + width: 300, + items: items, + allowClear: true, + defaultText: "请选择", + chooseType: BI.Selection.Multi, + listeners: [ + { + eventName: BI.TextValueCombo.EVENT_CHANGE, + action: function () { + console.log(this.getValue()); + } + } + ] + } + ] }) ] }; diff --git a/src/case/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js index 9a708cc83..7f726bd13 100644 --- a/src/case/combo/textvaluecombo/combo.textvalue.js +++ b/src/case/combo/textvaluecombo/combo.textvalue.js @@ -100,7 +100,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { eventName: BI.TextValueComboPopup.EVENT_CLEAR, action: (...args) => { changeTag = true; - this.setValue([]); + this._clear(); this.combo.hideView(); } }, { @@ -151,6 +151,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { }, _clear: function () { + this.trigger.setText(""); this.combo.setValue(); this.setStatus("success"); }, diff --git a/src/case/trigger/trigger.text.select.js b/src/case/trigger/trigger.text.select.js index 5a171be2e..cf1e2cdd9 100644 --- a/src/case/trigger/trigger.text.select.js +++ b/src/case/trigger/trigger.text.select.js @@ -20,15 +20,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { _init: function () { BI.SelectTextTrigger.superclass._init.apply(this, arguments); var self = this, o = this.options; - var obj = this._digest(o.value, o.items); + var text = this._digest(o.value, o.items); this.trigger = BI.createWidget({ type: "bi.text_trigger", element: this, height: o.height, readonly: o.readonly, - text: obj.text, + text: text, defaultText: o.defaultText, - textCls: obj.textCls, textHgap: o.textHgap, textVgap: o.textVgap, textLgap: o.textLgap, @@ -73,21 +72,9 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { }); if (result.length > 0 && val.length === 0) { - return { - textCls: "", - text: result.join(","), - }; + return result.join(","); } else { - var text = BI.isFunction(o.text) ? o.text() : o.text; - if (BI.isEmptyString(text)) { - return { - textCls: "bi-tips", - text: "" - }; - } - return { - text, - }; + return BI.isFunction(o.text) ? o.text() : o.text; } }, @@ -97,9 +84,8 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { }, setValue: function (val) { - var formatValue = this._digest(val, this.options.items); - this.trigger.setTextCls(formatValue.textCls); - this.trigger.setText(formatValue.text); + var formatText = this._digest(val, this.options.items); + this.trigger.setText(formatText); }, setTipType: function (v) {