diff --git a/dist/bundle.js b/dist/bundle.js index 5e618e8fdc..1d5752358c 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -99478,6 +99478,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multi-tree-combo", itemsCreator: BI.emptyFn, + valueFormatter: BI.emptyFn, height: 25 }); }, @@ -99495,6 +99496,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", height: o.height, + valueFormatter: o.valueFormatter, // adapter: this.popup, masker: { offset: this.constants.offset @@ -99973,6 +99975,9 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { return BI.extend(BI.MultiTreeSearcher.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multi-tree-searcher", itemsCreator: BI.emptyFn, + valueFormatter: function (v) { + return v; + }, popup: {}, adapter: null, @@ -100068,6 +100073,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { }, setState: function (ob) { + var o = this.options; ob || (ob = {}); ob.value || (ob.value = {}); if (BI.isNumber(ob)) { @@ -100078,7 +100084,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { var text = ""; BI.each(ob.value, function (name, children) { var childNodes = getChildrenNode(children); - text += name + (childNodes === "" ? "" : (":" + childNodes)) + "; "; + text += (o.valueFormatter(name + "") || name) + (childNodes === "" ? "" : (":" + childNodes)) + "; "; }); this.editor.setState(text); } @@ -100089,7 +100095,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { BI.each(ob, function (name, children) { index++; var childNodes = getChildrenNode(children); - text += name + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ","); + text += (o.valueFormatter(name + "") || name) + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ","); }); return text; } @@ -109790,7 +109796,8 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, { var text = v; if (BI.isNotNull(this.items)) { BI.some(this.items, function (i, item) { - if (item.value === v) { + // 把value都换成字符串 + if (item.value + "" === v) { text = item.text; return true; } @@ -109979,6 +109986,19 @@ BI.shortcut("bi.all_value_chooser_pane", BI.AllValueChooserPane);BI.AbstractTree }); }, + _valueFormatter: function (v) { + var text = v; + if (BI.isNotNull(this.items)) { + BI.some(this.items, function (i, item) { + if (item.value + "" === v) { + text = item.text; + return true; + } + }); + } + return text; + }, + _initData: function (items) { this.items = items; var nodes = BI.Tree.treeFormat(items); @@ -110652,6 +110672,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { type: "bi.multi_tree_combo", element: this, itemsCreator: BI.bind(this._itemsCreator, this), + valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, height: o.height }); @@ -110752,7 +110773,8 @@ BI.AbstractValueChooser = BI.inherit(BI.Widget, { var text = v; if (BI.isNotNull(this.items)) { BI.some(this.items, function (i, item) { - if (item.value === v) { + // 把value都换成字符串 + if (item.value + "" === v) { text = item.text; return true; } diff --git a/dist/widget.js b/dist/widget.js index c3d9620776..6ac30f5b8a 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -12843,6 +12843,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multi-tree-combo", itemsCreator: BI.emptyFn, + valueFormatter: BI.emptyFn, height: 25 }); }, @@ -12860,6 +12861,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", height: o.height, + valueFormatter: o.valueFormatter, // adapter: this.popup, masker: { offset: this.constants.offset @@ -13338,6 +13340,9 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { return BI.extend(BI.MultiTreeSearcher.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multi-tree-searcher", itemsCreator: BI.emptyFn, + valueFormatter: function (v) { + return v; + }, popup: {}, adapter: null, @@ -13433,6 +13438,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { }, setState: function (ob) { + var o = this.options; ob || (ob = {}); ob.value || (ob.value = {}); if (BI.isNumber(ob)) { @@ -13443,7 +13449,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { var text = ""; BI.each(ob.value, function (name, children) { var childNodes = getChildrenNode(children); - text += name + (childNodes === "" ? "" : (":" + childNodes)) + "; "; + text += (o.valueFormatter(name + "") || name) + (childNodes === "" ? "" : (":" + childNodes)) + "; "; }); this.editor.setState(text); } @@ -13454,7 +13460,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { BI.each(ob, function (name, children) { index++; var childNodes = getChildrenNode(children); - text += name + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ","); + text += (o.valueFormatter(name + "") || name) + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ","); }); return text; } @@ -23155,7 +23161,8 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, { var text = v; if (BI.isNotNull(this.items)) { BI.some(this.items, function (i, item) { - if (item.value === v) { + // 把value都换成字符串 + if (item.value + "" === v) { text = item.text; return true; } @@ -23344,6 +23351,19 @@ BI.shortcut("bi.all_value_chooser_pane", BI.AllValueChooserPane);BI.AbstractTree }); }, + _valueFormatter: function (v) { + var text = v; + if (BI.isNotNull(this.items)) { + BI.some(this.items, function (i, item) { + if (item.value + "" === v) { + text = item.text; + return true; + } + }); + } + return text; + }, + _initData: function (items) { this.items = items; var nodes = BI.Tree.treeFormat(items); @@ -24017,6 +24037,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { type: "bi.multi_tree_combo", element: this, itemsCreator: BI.bind(this._itemsCreator, this), + valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, height: o.height }); @@ -24117,7 +24138,8 @@ BI.AbstractValueChooser = BI.inherit(BI.Widget, { var text = v; if (BI.isNotNull(this.items)) { BI.some(this.items, function (i, item) { - if (item.value === v) { + // 把value都换成字符串 + if (item.value + "" === v) { text = item.text; return true; } diff --git a/src/component/allvaluechooser/abstract.allvaluechooser.js b/src/component/allvaluechooser/abstract.allvaluechooser.js index 782caa93f4..8f5e3a8f3a 100644 --- a/src/component/allvaluechooser/abstract.allvaluechooser.js +++ b/src/component/allvaluechooser/abstract.allvaluechooser.js @@ -26,7 +26,8 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, { var text = v; if (BI.isNotNull(this.items)) { BI.some(this.items, function (i, item) { - if (item.value === v) { + // 把value都换成字符串 + if (item.value + "" === v) { text = item.text; return true; } diff --git a/src/component/treevaluechooser/abstract.treevaluechooser.js b/src/component/treevaluechooser/abstract.treevaluechooser.js index b892d19fd9..da4c738edd 100644 --- a/src/component/treevaluechooser/abstract.treevaluechooser.js +++ b/src/component/treevaluechooser/abstract.treevaluechooser.js @@ -11,6 +11,19 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { }); }, + _valueFormatter: function (v) { + var text = v; + if (BI.isNotNull(this.items)) { + BI.some(this.items, function (i, item) { + if (item.value + "" === v) { + text = item.text; + return true; + } + }); + } + return text; + }, + _initData: function (items) { this.items = items; var nodes = BI.Tree.treeFormat(items); diff --git a/src/component/treevaluechooser/combo.treevaluechooser.js b/src/component/treevaluechooser/combo.treevaluechooser.js index 025094fa3b..4831945c0f 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.js @@ -27,6 +27,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { type: "bi.multi_tree_combo", element: this, itemsCreator: BI.bind(this._itemsCreator, this), + valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, height: o.height }); diff --git a/src/component/valuechooser/abstract.valuechooser.js b/src/component/valuechooser/abstract.valuechooser.js index 0d1ce422a9..128ae49565 100644 --- a/src/component/valuechooser/abstract.valuechooser.js +++ b/src/component/valuechooser/abstract.valuechooser.js @@ -24,7 +24,8 @@ BI.AbstractValueChooser = BI.inherit(BI.Widget, { var text = v; if (BI.isNotNull(this.items)) { BI.some(this.items, function (i, item) { - if (item.value === v) { + // 把value都换成字符串 + if (item.value + "" === v) { text = item.text; return true; } diff --git a/src/widget/multitree/multi.tree.combo.js b/src/widget/multitree/multi.tree.combo.js index 23db361dad..78427303f0 100644 --- a/src/widget/multitree/multi.tree.combo.js +++ b/src/widget/multitree/multi.tree.combo.js @@ -19,6 +19,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multi-tree-combo", itemsCreator: BI.emptyFn, + valueFormatter: BI.emptyFn, height: 25 }); }, @@ -36,6 +37,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", height: o.height, + valueFormatter: o.valueFormatter, // adapter: this.popup, masker: { offset: this.constants.offset diff --git a/src/widget/multitree/trigger/searcher.multi.tree.js b/src/widget/multitree/trigger/searcher.multi.tree.js index 12db605f2c..12200f5654 100644 --- a/src/widget/multitree/trigger/searcher.multi.tree.js +++ b/src/widget/multitree/trigger/searcher.multi.tree.js @@ -10,6 +10,9 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { return BI.extend(BI.MultiTreeSearcher.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multi-tree-searcher", itemsCreator: BI.emptyFn, + valueFormatter: function (v) { + return v; + }, popup: {}, adapter: null, @@ -105,6 +108,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { }, setState: function (ob) { + var o = this.options; ob || (ob = {}); ob.value || (ob.value = {}); if (BI.isNumber(ob)) { @@ -115,7 +119,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { var text = ""; BI.each(ob.value, function (name, children) { var childNodes = getChildrenNode(children); - text += name + (childNodes === "" ? "" : (":" + childNodes)) + "; "; + text += (o.valueFormatter(name + "") || name) + (childNodes === "" ? "" : (":" + childNodes)) + "; "; }); this.editor.setState(text); } @@ -126,7 +130,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { BI.each(ob, function (name, children) { index++; var childNodes = getChildrenNode(children); - text += name + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ","); + text += (o.valueFormatter(name + "") || name) + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ","); }); return text; }