diff --git a/demo/js/widget/tree/demo.multilayer_single_level_tree.js b/demo/js/widget/tree/demo.multilayer_single_level_tree.js index cb5c21da0..49f4f9a39 100644 --- a/demo/js/widget/tree/demo.multilayer_single_level_tree.js +++ b/demo/js/widget/tree/demo.multilayer_single_level_tree.js @@ -7,23 +7,23 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { render: function () { var self = this; - var tree = BI.createWidget({ + this.tree = BI.createWidget({ type: "bi.multilayer_single_level_tree", - items: BI.deepClone(Demo.CONSTANTS.TREE), - value: "第五级文件1" + items: [], + value: "第二级文件1" }); return { type: "bi.vtape", items: [{ - el: tree + el: this.tree }, { el: { type: "bi.button", height: 25, text: "getValue", handler: function () { - BI.Msg.alert("", JSON.stringify(tree.getValue())); + BI.Msg.alert("", JSON.stringify(self.tree.getValue())); } }, height: 25 @@ -33,7 +33,7 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { height: 25, text: "setValue (第二级文件1)", handler: function () { - tree.setValue(["第二级文件1"]); + self.tree.setValue(["第二级文件1"]); } }, height: 25 @@ -41,6 +41,10 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { width: 500, hgap: 300 }; + }, + + mounted: function () { + this.tree.populate(BI.deepClone(Demo.CONSTANTS.TREE)); } }); diff --git a/dist/base.js b/dist/base.js index be372e602..d52ed6ff0 100644 --- a/dist/base.js +++ b/dist/base.js @@ -34238,12 +34238,13 @@ BI.CustomTree = BI.inherit(BI.Widget, { if (BI.isNotEmptyArray(node.children) || node.isParent === true) { var item = BI.extend({ type: "bi.expander", - el: {}, + el: { + value: node.value + }, popup: {type: "bi.custom_tree"} }, BI.deepClone(o.expander), { id: node.id, - pId: node.pId, - value: node.value + pId: node.pId }); var el = BI.stripEL(node); if (!BI.isWidget(el)) { diff --git a/dist/bundle.js b/dist/bundle.js index 8e5f37c84..6d6eee6e5 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -69724,12 +69724,13 @@ BI.CustomTree = BI.inherit(BI.Widget, { if (BI.isNotEmptyArray(node.children) || node.isParent === true) { var item = BI.extend({ type: "bi.expander", - el: {}, + el: { + value: node.value + }, popup: {type: "bi.custom_tree"} }, BI.deepClone(o.expander), { id: node.id, - pId: node.pId, - value: node.value + pId: node.pId }); var el = BI.stripEL(node); if (!BI.isWidget(el)) { @@ -97156,7 +97157,10 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }, getValue: function () { - return BI.uniq(this.tree.getValue()); + return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) { + return BI.isNotNull(value); + }); + }, getAllLeaves: function () { diff --git a/dist/demo.js b/dist/demo.js index 48d29334c..f4c100ea5 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -14231,23 +14231,23 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { render: function () { var self = this; - var tree = BI.createWidget({ + this.tree = BI.createWidget({ type: "bi.multilayer_single_level_tree", - items: BI.deepClone(Demo.CONSTANTS.TREE), - value: "第五级文件1" + items: [], + value: "第二级文件1" }); return { type: "bi.vtape", items: [{ - el: tree + el: this.tree }, { el: { type: "bi.button", height: 25, text: "getValue", handler: function () { - BI.Msg.alert("", JSON.stringify(tree.getValue())); + BI.Msg.alert("", JSON.stringify(self.tree.getValue())); } }, height: 25 @@ -14257,7 +14257,7 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { height: 25, text: "setValue (第二级文件1)", handler: function () { - tree.setValue(["第二级文件1"]); + self.tree.setValue(["第二级文件1"]); } }, height: 25 @@ -14265,6 +14265,10 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { width: 500, hgap: 300 }; + }, + + mounted: function () { + this.tree.populate(BI.deepClone(Demo.CONSTANTS.TREE)); } }); diff --git a/dist/widget.js b/dist/widget.js index abbaaad8d..a779189f8 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -10485,7 +10485,10 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }, getValue: function () { - return BI.uniq(this.tree.getValue()); + return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) { + return BI.isNotNull(value); + }); + }, getAllLeaves: function () { diff --git a/src/base/tree/customtree.js b/src/base/tree/customtree.js index fb9eb1346..a72edba2a 100644 --- a/src/base/tree/customtree.js +++ b/src/base/tree/customtree.js @@ -44,12 +44,13 @@ BI.CustomTree = BI.inherit(BI.Widget, { if (BI.isNotEmptyArray(node.children) || node.isParent === true) { var item = BI.extend({ type: "bi.expander", - el: {}, + el: { + value: node.value + }, popup: {type: "bi.custom_tree"} }, BI.deepClone(o.expander), { id: node.id, - pId: node.pId, - value: node.value + pId: node.pId }); var el = BI.stripEL(node); if (!BI.isWidget(el)) { diff --git a/src/widget/multilayersingletree/multilayersingletree.leveltree.js b/src/widget/multilayersingletree/multilayersingletree.leveltree.js index ae0948cc1..bf2dd6b31 100644 --- a/src/widget/multilayersingletree/multilayersingletree.leveltree.js +++ b/src/widget/multilayersingletree/multilayersingletree.leveltree.js @@ -112,7 +112,10 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }, getValue: function () { - return BI.uniq(this.tree.getValue()); + return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) { + return BI.isNotNull(value); + }); + }, getAllLeaves: function () {