<head>
//权限列表
$( document ).ready(function(){
var parentId = 0;
$('#tt').treegrid({
url:'queryPrivilege.action?parentId='+parentId,
idField:'id',
treeField:'RecordStatus',
columns:[[
{title:'id',field:'id',width:180},
{field:'RecordStatus',title:'RecordStatus',width:180} ,
{field:'PrivilegeOperation',title:'PrivilegeOperation',width:180}
]],
onBeforeExpand:function(row){
//动态设置展开查询的url
$(this).treegrid('options').url = 'queryPrivilege.action?parentId='+row.id;
}
});
})
</script>
</head>
<body>
<table id="tt" style="width:600px;height:400px"></table>
</body>
//输出
public PrintWriter out()throws IOException{
HttpServletResponse response=ServletActionContext.getResponse();
response.setContentType("text/html");
response.setContentType("text/plain; charset=utf-8");
PrintWriter out= response.getWriter();
return out;
}
public String queryPrivilege() throws IOException{
returnpd="ok";
JSONArray array =new JSONArray();
array = privilegeService.getMenu(parentId);
String str=array.toString();
out().print(str);
out().flush();
out().close();
return returnpd;
}
JSONArray getMenu(int parentId);
@Override
public JSONArray getMenu(int parentId) {
// TODO Auto-generated method stub
return (JSONArray)privilegeDao.getMenu(parentId);
}
JSONArray getMenu(int parentId);
@Override
public JSONArray getMenu(int parentId) {
// TODO Auto-generated method stub
String hql="";
JSONArray array=new JSONArray();
hql="FROM Privilege p WHERE p.parentID = "+parentId;
for(Privilege privilege:(List<Privilege>)(getSession().createQuery(hql).list())){
JSONObject jo=new JSONObject();
jo.put("id", privilege.getId());
jo.put("RecordStatus", privilege.getRecordStatus());
jo.put("parendId",privilege.getParentID());
if(privilege.getParentID()==0){
jo.put("state","closed");
}
else{
jo.put("state","open");
System.out.println(parentId);
}
array.add(jo);
}
return array;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有