jQuery MiniUI
标题:
outlooktree静态初始化的问题,请指点
[打印本页]
作者:
蛮大人
时间:
2012-8-20 11:18:35
标题:
outlooktree静态初始化的问题,请指点
本帖最后由 蛮大人 于 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中的样子如下:
[attach]362[/attach]
本地运行实际样子如下
[attach]363[/attach]
不知道是不是 outlooktree不支持这样的静态调用。请各位指点迷津!
作者:
niko
时间:
2012-8-20 11:42:24
JS设置的话,你数据结构要做成树形的,以children为子节点。
[
{ id: '1', text: '',
children: [
...
]
}
]
作者:
蛮大人
时间:
2012-8-20 14:08:47
niko 发表于 2012-8-20 11:42
JS设置的话,你数据结构要做成树形的,以children为子节点。
[
{ id: '1', text: '',
我使用的是demo中的 url对应的txt的数据结构。
两者处理机制看起来还不一致?
作者:
niko
时间:
2012-8-20 14:33:17
你还是通过url加载把。
欢迎光临 jQuery MiniUI (http://miniui.com/discuss/)
Powered by Discuz! X2