- 注册时间
- 2012-6-26
- 最后登录
- 2012-7-24
- 阅读权限
- 10
- 积分
- 15
- 精华
- 0
- 帖子
- 3
|
以下是我将DEMO的代码与修改的代码做的比较,请问要怎么配置才可以使用JSON数据源?
- 示例代码:
- <div id="leftTree" class="mini-outlooktree" url="../data/outlooktree.txt" onnodeselect="onNodeSelect" textField="text" idField="id" parentField="pid">
- </div>
复制代码- 示例outlooktree.txt JSON格式数据
- [
- {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"}
- ]
复制代码
我修改的JSP代码:
- <div id="leftTree" class="mini-outlooktree" url="/getMenu" onnodeselect="onNodeSelect" textField="text" idField="id" parentField="pid">
- </div>
复制代码 http://localhost:8080/getMenu JSON返回的数据
- {"getMenu":[{"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"}]}
复制代码
|
|