兩級節點的樹node
效果圖:json
說明:這是隻顯示兩級節點的樹,而且窗體加載的時候樹就成展開形式,並不須要異步加載!異步
Jsp:ui
/**url
* 初始投訴分類code
*/blog
function p_initpreclass(){get
//左側分類樹it
treeManager = $("#complaintree").ligerTree({ io
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: