欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

jQuery treepanel动态加载数据实现代码

程序员文章站 2022-08-31 12:59:22
jquery treepanel动态加载数据实现代码如下: var tree = new ext.tree.treepanel({ region:'west',...

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());
}