From 96919cf0ba251c53a94eddebdbd6f200337c8fc1 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 16 Sep 2020 15:30:09 +0800 Subject: [PATCH] =?UTF-8?q?BI-71788=20fix:=20allvaluechoosercombo=20setVal?= =?UTF-8?q?ue=E6=89=80=E6=9C=89=E5=80=BCtrigger=E6=98=BE=E7=A4=BA=E9=83=A8?= =?UTF-8?q?=E5=88=86=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../allvaluechooser/abstract.allvaluechooser.js | 17 ++++++++++++++++- .../allvaluechooser/combo.allvaluechooser.js | 8 ++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/component/allvaluechooser/abstract.allvaluechooser.js b/src/component/allvaluechooser/abstract.allvaluechooser.js index 332a1737dd..1f30e8de8b 100644 --- a/src/component/allvaluechooser/abstract.allvaluechooser.js +++ b/src/component/allvaluechooser/abstract.allvaluechooser.js @@ -82,5 +82,20 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, { hasNext: false }); } - } + }, + + _assertValue: function (v) { + v = v || {}; + var value = v; + if (BI.isNotNull(this.items)) { + var isAllSelect = BI.difference(BI.map(this.items, "value"), v.value).length === 0; + if (isAllSelect) { + value = { + type: BI.Selection.All, + value: [], + }; + } + } + return value; + }, }); \ No newline at end of file diff --git a/src/component/allvaluechooser/combo.allvaluechooser.js b/src/component/allvaluechooser/combo.allvaluechooser.js index 3b7306a6ad..8c170867af 100644 --- a/src/component/allvaluechooser/combo.allvaluechooser.js +++ b/src/component/allvaluechooser/combo.allvaluechooser.js @@ -33,10 +33,10 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, { valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, height: o.height, - value: { + value: this._assertValue({ type: BI.Selection.Multi, value: o.value || [] - } + }) }); this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { @@ -45,10 +45,10 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, { }, setValue: function (v) { - this.combo.setValue({ + this.combo.setValue(this._assertValue({ type: BI.Selection.Multi, value: v || [] - }); + })); }, getValue: function () {