From 50c0ac8ae052a6b20761c5be84938d3d6fb24b92 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 23 Sep 2019 12:27:46 +0800 Subject: [PATCH] =?UTF-8?q?BI-51490=20fix:=20=E6=96=87=E6=9C=AC=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=B2=98=E8=B4=B4=E5=80=BC=E9=80=BB=E8=BE=91=E5=92=8C?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multiselectlist/multiselectlist.insert.js | 20 ++++++++----------- .../multiselectlist.insert.nobar.js | 20 ++++++++----------- src/widget/multiselectlist/multiselectlist.js | 20 ++++++++----------- 3 files changed, 24 insertions(+), 36 deletions(-) diff --git a/src/widget/multiselectlist/multiselectlist.insert.js b/src/widget/multiselectlist/multiselectlist.insert.js index 6cc5959d9..9d8aff81d 100644 --- a/src/widget/multiselectlist/multiselectlist.insert.js +++ b/src/widget/multiselectlist/multiselectlist.insert.js @@ -210,16 +210,14 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, { _joinKeywords: function (keywords, callback) { var self = this, o = this.options; this._assertValue(this.storeValue); - if (!this._allData) { - o.itemsCreator({ - type: BI.MultiSelectInsertList.REQ_GET_ALL_DATA - }, function (ob) { - self._allData = BI.map(ob.items, "value"); - digest(self._allData); - }); - } else { - digest(this._allData); - } + // 和复选下拉框同步,allData做缓存是会爆炸的 + o.itemsCreator({ + type: BI.MultiSelectInsertList.REQ_GET_ALL_DATA, + keywords: keywords + }, function (ob) { + var values = BI.map(ob.items, "value"); + digest(values); + }); function digest (items) { var selectedMap = self._makeMap(items); @@ -320,8 +318,6 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, { }, populate: function () { - this._count = null; - this._allData = null; this.adapter.populate.apply(this.adapter, arguments); this.trigger.populate.apply(this.trigger, arguments); } diff --git a/src/widget/multiselectlist/multiselectlist.insert.nobar.js b/src/widget/multiselectlist/multiselectlist.insert.nobar.js index a273d942d..5254fbf93 100644 --- a/src/widget/multiselectlist/multiselectlist.insert.nobar.js +++ b/src/widget/multiselectlist/multiselectlist.insert.nobar.js @@ -218,16 +218,14 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, { _joinKeywords: function (keywords, callback) { var self = this, o = this.options; this._assertValue(this.storeValue); - if (!this._allData) { - o.itemsCreator({ - type: BI.MultiSelectInsertNoBarList.REQ_GET_ALL_DATA - }, function (ob) { - self._allData = BI.map(ob.items, "value"); - digest(self._allData); - }); - } else { - digest(this._allData); - } + // 和复选下拉框同步,allData做缓存是会爆炸的 + o.itemsCreator({ + type: BI.MultiSelectInsertNoBarList.REQ_GET_ALL_DATA, + keywords: keywords + }, function (ob) { + var values = BI.map(ob.items, "value"); + digest(values); + }); function digest (items) { var selectedMap = self._makeMap(items); @@ -330,8 +328,6 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, { }, populate: function () { - this._count = null; - this._allData = null; this.adapter.populate.apply(this.adapter, arguments); this.trigger.populate.apply(this.trigger, arguments); } diff --git a/src/widget/multiselectlist/multiselectlist.js b/src/widget/multiselectlist/multiselectlist.js index 3b52b9e56..f6b368a2e 100644 --- a/src/widget/multiselectlist/multiselectlist.js +++ b/src/widget/multiselectlist/multiselectlist.js @@ -192,16 +192,14 @@ BI.MultiSelectList = BI.inherit(BI.Widget, { _joinKeywords: function (keywords, callback) { var self = this, o = this.options; this._assertValue(this.storeValue); - if (!this._allData) { - o.itemsCreator({ - type: BI.MultiSelectList.REQ_GET_ALL_DATA - }, function (ob) { - self._allData = BI.map(ob.items, "value"); - digest(self._allData); - }); - } else { - digest(this._allData); - } + // 和复选下拉框同步,allData做缓存是会爆炸的 + o.itemsCreator({ + type: BI.MultiSelectList.REQ_GET_ALL_DATA, + keywords: keywords + }, function (ob) { + var values = BI.map(ob.items, "value"); + digest(values); + }); function digest (items) { var selectedMap = self._makeMap(items); @@ -332,8 +330,6 @@ BI.MultiSelectList = BI.inherit(BI.Widget, { }, populate: function () { - this._count = null; - this._allData = null; this.adapter.populate.apply(this.adapter, arguments); this.trigger.populate.apply(this.trigger, arguments); }