From 82e0424535fd469ddbb05f83508f51271a8e5742 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 24 Jun 2022 11:31:43 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E9=80=89=E4=B8=AD=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/group.button.js | 11 +++++++++++ src/widget/multiselect/loader.js | 7 ++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/base/combination/group.button.js b/src/base/combination/group.button.js index a9ba5c23c..b88033487 100644 --- a/src/base/combination/group.button.js +++ b/src/base/combination/group.button.js @@ -233,6 +233,17 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { }); }, + setValueMap: function (map) { + map = map || {}; + BI.each(this.buttons, function (i, item) { + if (BI.isNotNull(map[item.getValue()])) { + item.setSelected && item.setSelected(true); + } else { + item.setSelected && item.setSelected(false); + } + }); + }, + getNotSelectedValue: function () { var v = []; BI.each(this.buttons, function (i, item) { diff --git a/src/widget/multiselect/loader.js b/src/widget/multiselect/loader.js index 8b010b45f..cdedd7f71 100644 --- a/src/widget/multiselect/loader.js +++ b/src/widget/multiselect/loader.js @@ -204,9 +204,10 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, { return this.cachGroup.getNotSelectedValue(); }, - setValue: function () { - this.cachGroup.setValue.apply(this.cachGroup, arguments); - this.button_group.setValue.apply(this.button_group, arguments); + setValue: function (value) { + var map = BI.makeObject(value); + this.cachGroup.setValueMap.call(this.cachGroup, map); + this.button_group.setValueMap.call(this.button_group, map); }, getValue: function () {