From 2aef70b44820f997ba5fa5d20e70f17ac1bc917c Mon Sep 17 00:00:00 2001 From: iapyang Date: Thu, 3 Dec 2020 17:19:14 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-44591=20fix:=20=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=8D=95=E9=80=89=E4=B8=8B=E6=8B=89=E6=A0=91?= =?UTF-8?q?=E7=9A=84valueFormatter=EF=BC=8C=E5=AD=98=E5=9C=A8o.valueFormat?= =?UTF-8?q?ter=E6=97=B6=E4=BC=98=E5=85=88=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multilayerselecttree.trigger.js | 13 ++++++++----- .../multilayersingletree.trigger.js | 14 +++++++++----- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js index 7022259f0f..a1716d0007 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js @@ -7,9 +7,6 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { return { extraCls: "bi-multi-layer-select-tree-trigger bi-border bi-focus-shadow bi-border-radius", height: 24, - valueFormatter: function (v) { - return v; - }, itemsCreator: BI.emptyFn, watermark: BI.i18nText("BI-Basic_Search"), allowSearchValue: false, @@ -202,13 +199,19 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _digest: function (v) { var o = this.options; - if(o.itemsCreator === BI.emptyFn) { + if (BI.isFunction(o.valueFormatter)) { + return o.valueFormatter(v); + } + + if (o.itemsCreator === BI.emptyFn) { var result = BI.find(o.items, function (i, item) { return item.value === v; }); + return BI.isNotNull(result) ? result.text : o.text; } - return o.valueFormatter(v); + + return v; }, _getShowText: function () { diff --git a/src/widget/multilayersingletree/multilayersingletree.trigger.js b/src/widget/multilayersingletree/multilayersingletree.trigger.js index 960f9838b8..376b29af3e 100644 --- a/src/widget/multilayersingletree/multilayersingletree.trigger.js +++ b/src/widget/multilayersingletree/multilayersingletree.trigger.js @@ -7,9 +7,6 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { return { extraCls: "bi-multi-layer-single-tree-trigger bi-border bi-focus-shadow bi-border-radius", height: 24, - valueFormatter: function (v) { - return v; - }, itemsCreator: BI.emptyFn, watermark: BI.i18nText("BI-Basic_Search"), allowSearchValue: false, @@ -202,13 +199,20 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _digest: function (v) { var o = this.options; - if(o.itemsCreator === BI.emptyFn) { + + if (BI.isFunction(o.valueFormatter)) { + return o.valueFormatter(v); + } + + if (o.itemsCreator === BI.emptyFn) { var result = BI.find(o.items, function (i, item) { return item.value === v; }); + return BI.isNotNull(result) ? result.text : o.text; } - return o.valueFormatter(v); + + return v; },