日期:2014-05-16 浏览次数:20726 次
var mytree = new Ext.tree.TreePanel({
region : 'west',
tbar : scheduleTreeToolbar,
split : true,
autoScroll : true,
animate : true,
collapsible : true,
frame : true,
enableDD : true,
enableDrag : true,
rootVisible : true, // 默认值 显示根节点
autoScroll : true,
autoHeight : true,
width : 250,
lines : true,
loader : new Ext.tree.TreeLoader({
baseAttrs : {},
dataUrl : contextPath
+ '/getPanel.action'
,
listeners : {
"loadexception" : function(loader, node, response) {
// 加载服务器数据
node.loaded = false;
node.reload.defer(10, node);
}
}
}),
useArrows : false,
// 根节点
root : new Ext.tree.AsyncTreeNode({
id : 'root',
text : '调度分类',
expanded : true
})
});
List menus = new ArrayList();
Lis bglist = scheduleService.getTreeBigCls();
for (int i = 0, len = bglist.size(); i < len; i++) {
TreeNodeJsonBean bzmenu = new TreeNodeJsonBean();
bzmenu.setId(bglist.get(i).getbid());
bzmenu.setText(bglist.get(i).getbidname());
bzmenu.setCls("folder");
bzmenu.setLeaf(false);
menus.add(bzmenu);
String assmoName= Struts2Utils.getParameter("name");
Set<String> assNameSet = new HashSet<String>();
assNameSet = scheduleService.getScheduleNames(assmoName,
bglist.get(i).getbid());
List benList = new ArrayList();
for (String item : assNameSet ) {
// 添加子类查询结果并添加到pacl
bzmenu.setChildren(benList);
TreeNodeJsonBean menu = new TreeNodeJsonBean();
menu.setId(item);
menu.setLeaf(true);
menu.setText(item);
menu.setCls("file");
benList.add(menu);
}
}
}
Struts2Utils.renderJson(menus, "encoding:UTF-8");