利用easyUI填充表格數據

easyui tree
後臺獲取json數據,根據前臺須要的json數據格式創建bean
如:
{ "id":1,
"text":"Folder1",
"iconCls":"icon-save",
"children":[{
"text":"File1",
"checked":true }
{
"text":"Books",
"state":"open",
"attributes":{
"url":"/demo/book/abc",
"price":100
},
1. bean實體類屬性 id text iconcls children(list) attributes (根據裏面屬性判斷爲map)
2. nodecontroller
@RequestMapping(value="myNodes", produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
treeNode tn=new treeNode(); tn.setid= "";tn.settext="";...
list<treeNode> nodes=new arrayList<treeNode>();
nodes.add(tn);//即獲取到的json數據
3.前臺經過easyUI獲取json數據經過樹的名字,${'#mytree'}
代碼以下
<script type="text/javascript">
$(function(){
//當頁面加載完畢以後,初始化樹
$('#myTree').tree({
url:'<%=basePath%>getMenu.do',
onClick:function(node){
alert(node.attributes.url);
if ($('#myTree').tree('isLeaf',node.target)) {
$("#myTabs").tabs('add',{
title:node.text,
href:"<%=basePath%>" + node.text,
closable:true,
iconCls:'icon-ok'javascript