From 8477c030ce99a8360febcde278332620317e1167 Mon Sep 17 00:00:00 2001 From: iapyang Date: Tue, 29 Aug 2017 17:10:13 +0800 Subject: [PATCH] finish tree --- uidoc/detailed/tree/bi.multi_tree_combo.md | 60 ++++++++++++++++++++++ uidoc/detailed/tree/bi.switch_tree.md | 48 +++++++++++++++++ 2 files changed, 108 insertions(+) diff --git a/uidoc/detailed/tree/bi.multi_tree_combo.md b/uidoc/detailed/tree/bi.multi_tree_combo.md index 821b51b8c..c0287ef69 100644 --- a/uidoc/detailed/tree/bi.multi_tree_combo.md +++ b/uidoc/detailed/tree/bi.multi_tree_combo.md @@ -1,2 +1,62 @@ # bi.multi_tree_combo +### 树下拉框 + +{% method %} +[source](https://jsfiddle.net/fineui/caw7efpf/) + +{% common %} +```javascript +var items = [{ + id: -1, + pId: -2, + value: "根目录", + text: "根目录" +}, { + id: 1, + pId: -1, + value: "第一级目录1", + text: "第一级目录1" +}, { + id: 11, + pId: 1, + value: "第二级文件1", + text: "第二级文件1" +}]; + +BI.createWidget({ + type: "bi.horizontal_auto", + element: "body", + items: [{ + type: "bi.multi_tree_combo", + ref: function (_ref) { + self.tree = _ref; + }, + itemsCreator: function (options, callback) { + console.log(options); + + callback({ + items: items + }); + }, + width: 300 + }, { + type: "bi.button", + text: "getVlaue", + handler: function () { + BI.Msg.toast(JSON.stringify(self.tree.getValue())); + }, + width: 300 + }] +}) +``` + +{% endmethod %} + +## 参数设置 +| 参数 | 说明 | 类型 | 默认值 | +| ----- | ------------- | ----- | ---- | +| items | 子项,pId代表父节点ID | array | [] | + +## 方法 +### 通用方法参见[Tree](#)方法 \ No newline at end of file diff --git a/uidoc/detailed/tree/bi.switch_tree.md b/uidoc/detailed/tree/bi.switch_tree.md index 01f9fa009..6d1e7645b 100644 --- a/uidoc/detailed/tree/bi.switch_tree.md +++ b/uidoc/detailed/tree/bi.switch_tree.md @@ -1,2 +1,50 @@ # bi.switch_tree +### 可切换树 + +{% method %} +[source](https://jsfiddle.net/fineui/crd4z1nd/) + +{% common %} +```javascript +var items = [{ + id: -1, + pId: -2, + value: "根目录", + text: "根目录" +}, { + id: 1, + pId: -1, + value: "第一级目录1", + text: "第一级目录1" +}, { + id: 11, + pId: 1, + value: "第二级文件1", + text: "第二级文件1" +}]; + +var tree = BI.createWidget({ + type: "bi.switch_tree", + items: items, +}); +``` + +{% endmethod %} + +## 参数设置 +| 参数 | 说明 | 类型 | 默认值 | +| ----- | ------------- | ----- | ---- | +| items | 子项,pId代表父节点ID | array | [] | + +## 方法 +### 通用方法参见[Tree](#)方法 + +| 方法名 | 说明 | 用法 | +| ------------ | ----- | ------------ | +| switchSelect | 切换树结构 | switchSelect | + + + + +