jquery中EasyUI同步树的实现代码
在JS中,将显示树的url地址写成control的地址即可.
代码如下:
@RequestMapping(value = "/tree")
public void tree(HttpServletRequest request, HttpServletResponse response) throws IOException {
eJson(response, ree());
}
dao:
复制代码 代码如下:
/**
* 获取树
*/
@Override
public ListgetTree(){
try {
Listtrees = new ArrayList();
Listroot = ch(0);
if(root != null && () > 0){
for(TBookType tb : root){
Tree rootnode = ode(tb);
tate("open");
(rootnode);
}
}
return trees;
} catch (Exception e) {
tStackTrace();
return null;
}
}
/**
* 递归
*/
private Tree getNode(TBookType node){
if(node == null){
return null;
}
try {
Tree treenode = new Tree();
d(eOf(d()));
ext(ame());
id(eOf(id()));
Listchildren = ch(d());
if(children != null && () > 0){
tate("closed");
for(TBookType child : children){
Tree childnode = ode(child);
if(childnode != null){
hildren()(childnode);//递归
}
}
}
return treenode;
} catch (Exception e) {
throw new BusinessException("获取数据出错!", e);
}
}