jQuery treepanel动态加载数据实现代码
jquery treepanel动态加载数据实现代码如下:
var tree = new ext.tree.treepanel({
region:'west',
title:'站点树:',
width:200,
minsize:150,
maxsize:200,
iconcls:'ux-auth-menu-header-icon',
split:true,
autoscroll:true,
autoheight:false,
collapsible:true,
rootvisable:false, //不显示根节点
root:new ext.tree.treenode({
id:'root',
text:'分所',
draggable:false,
expanded:true
}),
loader:new ext.tree.treeloader({
dataurl:'treeutil.html?content.method=getallmenutreenodes'
})
});
public void getallmenutreenodes(actionmapping mapping, actionform form,
httpservletrequest request, httpservletresponse response) {
string systemid = request.getparameter("node");
string havecheckbox = request.getparameter("havecheckbox");
imenumanager menumanager = this.getpkgserver().getdriver().getsystemmanageserver().getmenumanager();
list<hashmap> nodes = new arraylist<hashmap>();
string parentnodename =menumanager.getmenu(long.parselong(systemid)).getname() ;
list<menu> menus = menumanager.getmenus("em.parent_name= '" +parentnodename + "'");
for(menu menu:menus){
hashmap<string, object> hm=new hashmap<string, object>();
hm.put("id", menu.getid());
hm.put("text", menu.gettitle());
hm.put("iconcls",menu.getname());
nodes.add(hm);
}
jsonarray ary = new jsonarray(nodes);
writejson(response, ary.tostring());
}
上一篇: WordPress导出全静态化网站
下一篇: js数组去重的四种方式介绍