當前位置:才華齋>設計>網頁設計>

jquery中EasyUI同步樹的實現程式碼

網頁設計 閱讀(9.79K)

在JS中,將顯示樹的url地址寫成control的地址即可.

jquery中EasyUI同步樹的實現程式碼

程式碼如下:

@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);

}

}