两级节点的树
效果图:
说明:这是只显示两级节点的树,并且窗体加载的时候树就成展开形式,并不需要异步加载!
Jsp:
/**
* 初始投诉分类
*/
function p_initpreclass(){
//左侧分类树
treeManager = $("#complaintree").ligerTree({
url : "../press/prereflectclassify!showtree.action",
nodeDraggable: false,
checkbox : false,
idFieldName : "classid",[d1]
parentIDFieldName : "parentid",
textFieldName : "name",[d2]
nodeWidth: 100,
onClick : function(node){
currentClassId = node.data.classid;
listcomplain(currentClassId);[d3] [d4]
},
single : true
});
}
function listcomplain(classid[d5] ){
gridManager.setOptions( {
parms : [ {
name : 'filter_EQL_classid',
value : classid
} ]
});
gridManager.loadData(true);
}
Action:
public String showtree() throws Exception{
List<PropertyFilter> filters = PropertyFilter.buildFromHttpRequest(Struts2Utils.getRequest());
//classcode = Struts2Utils.getRequest().getParameter("classcode");
//filters = genFilterList(filters, "LIKES", "classcode", classcode);[d6]
List<PreReflectClassify> lRet = manager.listclass(filters);
JsonConfig config = new JsonConfig();
config.setExcludes(new String[] {"subsysid","memo","creator","createtime","lastmodify","updater","orders"});
JSONArray jsonArray = JSONArray.fromObject(lRet,config);
[d7] Struts2Utils.renderText(jsonArray.toString());
return NONE;
}
//JSONArray jsonArray=new JSONArray();
JSONObject JSONObj=new JSONObject();
for(PreReflectClassify c: lRet){
JSONObj.put(“subsysid”,c.getSubsysid);
JSONObj.put(“memo”,c.getMemo);
……..
jsonArray.add(JSONObj);
}
Struts2Utils.renderText(jsonArray.toString());
//投诉分类的处理
public List<PreReflectClassify> listclass(List<PropertyFilter> filters){
return classdao.find(filters[d10] );
}
Dao: