easyui树拖拽排序java_项目中集成Easyui-Tree,可拖拽更新节点
public String getTreeView(String treeId) throwsDefaultException {try{
List tree= dao.getTreeNode(treeId);
//dao 判斷 StringUtils.isNotBlank(treeId)?treeId:0
JSONArray toTree = new JSONArray();
//使用的是 struts1 + hibernate3 沒有spring 也不允許加入其它jar包。。。
if (tree.size()>0) {for (int i = 0; i < tree.size(); i++) {
ContractCagetoryVO rootVo=(ContractCagetoryVO)tree.get(i);
JSONObject topNode= newJSONObject();
topNode.put("id", rootVo.getFid());
topNode.put("attributes", rootVo.getFisWrite()); //自定義屬性
topNode.put("text",rootVo.getFname());
topNode.put("state", "open");//初始化時需要展示子節(jié)點
List nodes =dao.getTreeNode(rootVo.getFid());if (nodes.size()>0) {
List tempList= newArrayList();
Iterator ti=nodes.iterator();while(ti.hasNext()){
JSONObject childerNode= newJSONObject();
ContractCagetoryVO nodeVo=(ContractCagetoryVO) ti.next();
childerNode.put("id", nodeVo.getFid());
childerNode.put("attributes", nodeVo.getFisWrite()); //自定義屬性
childerNode.put("text",nodeVo.getFname());
childerNode.put("state", "closed");
tempList.add(childerNode);
}
topNode.put("children",tempList);
}
toTree.put(topNode);
}
}returntoTree.toString();
}catch(Exception e) {throw newDefaultException(e);
}
}
總結(jié)
以上是生活随笔為你收集整理的easyui树拖拽排序java_项目中集成Easyui-Tree,可拖拽更新节点的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java统计行列和字数的函数_JAVA使
- 下一篇: md5课程设计java_MD5算法的JA