diff --git a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js index 7022259f0..a1716d000 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 960f9838b..376b29af3 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; },