- 注册时间
- 2012-8-17
- 最后登录
- 2012-8-22
- 阅读权限
- 10
- 积分
- 11
- 精华
- 0
- 帖子
- 2
|
本帖最后由 蛮大人 于 2012-8-20 11:19 编辑
miniUI 的 tree控件,URL相关的参数必须要webserver支持才能加载;
在本地搭建原型测试时,需要静态html显示(没有webserver配合);
翻了翻tree控件有个 loaddata(Array)的方法,也看到了对应的demo代码;
比照着写了outlooktree的静态初始化,查了API,使用了load(Array)的方法;数据使用的是demo中对应的outlooktree.txt
- [
- {id: "user", text: "用户管理"},
- {id: "lists", text: "Lists", pid: "user" },
- {id: "datagrid", text: "DataGrid", pid: "lists"},
- {id: "tree", text: "Tree" , pid: "lists"},
- {id: "treegrid", text: "TreeGrid " , pid: "lists"},
- {id: "layouts", text: "Layouts", expanded: false, pid: "user"},
- {id: "panel", text: "Panel", pid: "layouts"},
- {id: "splitter", text: "Splitter", pid: "layouts"},
- {id: "layout", text: "Layout ", pid: "layouts"},
- { id: "right", text: "权限管理"},
- {id: "base", text: "Base", expanded: false, pid: "right" },
- {id: "ajax", text: "Ajax", pid: "base"},
- {id: "json", text: "JSON", pid: "base"},
- {id: "date", text: "Date", pid: "base"},
- {id: "forms", text: "Forms", expanded: false, pid: "right"},
- {id: "button", text: "Button", pid: "forms"},
- {id: "listbox", text: "ListBox", pid: "forms"},
- {id: "checkboxlist", text: "CheckBoxList", pid: "forms"},
- {id: "radiolist", text: "RadioList", pid: "forms"},
- {id: "calendar", text: "Calendar", pid: "forms"}
- ]
复制代码
调用的代码如下:
- <script type="text/javascript">
- mini.parse();
- var tree = mini.get("leftTree");
- tree.load([
- {id: "user", text: "用户管理"},
- {id: "lists", text: "Lists", pid: "user" },
- {id: "datagrid", text: "DataGrid", pid: "lists"},
- {id: "tree", text: "Tree" , pid: "lists"},
- {id: "treegrid", text: "TreeGrid " , pid: "lists"},
- {id: "layouts", text: "Layouts", expanded: false, pid: "user"},
- {id: "panel", text: "Panel", pid: "layouts"},
- {id: "splitter", text: "Splitter", pid: "layouts"},
- {id: "layout", text: "Layout ", pid: "layouts"},
- { id: "right", text: "权限管理"},
- {id: "base", text: "Base", expanded: false, pid: "right" },
- {id: "ajax", text: "Ajax", pid: "base"},
- {id: "json", text: "JSON", pid: "base"},
- {id: "date", text: "Date", pid: "base"},
- {id: "forms", text: "Forms", expanded: false, pid: "right"},
- {id: "button", text: "Button", pid: "forms"},
- {id: "listbox", text: "ListBox", pid: "forms"},
- {id: "checkboxlist", text: "CheckBoxList", pid: "forms"},
- {id: "radiolist", text: "RadioList", pid: "forms"},
- {id: "calendar", text: "Calendar", pid: "forms"}
- ]);
- </script>
复制代码 body对应的html如下:
- <div id="layout1" class="mini-layout" style="width:100%;height:100%;">
- <div class="header" region="north" height="30" showSplit="false" showHeader="false">
- </div>
- <div title="south" region="south" showSplit="false" showHeader="false" height="30" >
- </div>
- <div title="center" region="center" bodyStyle="overflow:hidden;">
- <!--Splitter-->
- <div class="mini-splitter" style="width:100%;height:100%;" borderStyle="border:0;">
- <div size="180" maxSize="250" minSize="100" showCollapseButton="true">
-
- <!--OutlookTree-->
- <div id="leftTree" class="mini-outlookmenu ,mini-outlooktree" onnodeselect="onNodeSelect"
- textField="text" idField="id" parentField="pid"
- >
- </div>
-
-
- </div>
- <div showCollapseButton="false">
- <!--Tabs-->
- <div id="mainTabs" class="mini-tabs bg-toolbar" activeIndex="0" style="width:100%;height:100%;"
- bodyStyle="border:0;background:white;"
- >
- <div title="首页" url="data\tree.txt" >
-
- </div>
-
- </div>
- </div>
- </div>
- </div>
- </div>
复制代码 通过demo中的样子如下:
本地运行实际样子如下
不知道是不是 outlooktree不支持这样的静态调用。请各位指点迷津!
|
|