jquery中EasyUI實(shí)現(xiàn)同步樹
在JS中,將顯示樹的url地址寫成control的地址即可.
control:
@RequestMapping(value = "/tree")
public void tree(HttpServletRequest request, HttpServletResponse response) throws IOException {
this.writeJson(response, bookService.getTree());
}
dao:
/**
* 獲取樹
*/
@Override
public List<Tree> getTree(){
try {
List<Tree> trees = new ArrayList<Tree>();
List<TBookType> root = this.search(0);
if(root != null && root.size() > 0){
for(TBookType tb : root){
Tree rootnode = this.getNode(tb);
rootnode.setState("open");
trees.add(rootnode);
}
}
return trees;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 遞歸
*/
private Tree getNode(TBookType node){
if(node == null){
return null;
}
try {
Tree treenode = new Tree();
treenode.setId(String.valueOf(node.getId()));
treenode.setText(node.getName());
treenode.setPid(String.valueOf(node.getPid()));
List<TBookType> children = this.search(node.getId());
if(children != null && children.size() > 0){
treenode.setState("closed");
for(TBookType child : children){
Tree childnode = this.getNode(child);
if(childnode != null){
treenode.getChildren().add(childnode);//遞歸
}
}
}
return treenode;
} catch (Exception e) {
throw new BusinessException("獲取數(shù)據(jù)出錯(cuò)!", e);
}
}
以上就是使用EasyUI實(shí)現(xiàn)同步樹的全部核心代碼了,希望大家能夠喜歡。
- 淺談EasyUi ComBotree樹修改 父節(jié)點(diǎn)選擇的問題
- EasyUi combotree 實(shí)現(xiàn)動(dòng)態(tài)加載樹節(jié)點(diǎn)
- 輕松學(xué)習(xí)jQuery插件EasyUI EasyUI創(chuàng)建樹形菜單
- Jquery easyui 實(shí)現(xiàn)動(dòng)態(tài)樹
- jquery中EasyUI實(shí)現(xiàn)異步樹
- EasyUI Tree+Asp.net實(shí)現(xiàn)權(quán)限樹或目錄樹導(dǎo)航的簡單實(shí)例
- jQuery EasyUI API 中文文檔 - TreeGrid 樹表格使用介紹
- EasyUI創(chuàng)建人員樹的實(shí)例代碼
相關(guān)文章
解決IE7中使用jQuery動(dòng)態(tài)操作name問題
IE7中無法使用Jquery動(dòng)態(tài)操作頁面元素的name屬性,怎么解決這個(gè)問題呢?下面小編給大家?guī)砹私鉀QIE7中使用jQuery動(dòng)態(tài)操作name問題,需要的朋友參考下吧2017-08-08
jq實(shí)現(xiàn)酷炫的鼠標(biāo)經(jīng)過圖片翻滾效果
一個(gè)酷炫的圖片翻滾效果要實(shí)現(xiàn)這個(gè)效果并不難,只要思路對(duì)了,一切都好辦,下面有個(gè)不錯(cuò)的示例,大家可以參考下2014-03-03
jQuery EasyUI API 中文文檔 - NumberSpinner數(shù)值微調(diào)器使用介紹
jQuery EasyUI API 中文文檔 - NumberSpinner數(shù)值微調(diào)器使用,需要的朋友可以參考下。2011-10-10
CSS+Jquery實(shí)現(xiàn)頁面圓角框方法大全
前不久做項(xiàng)目,要用到大量的頁面圓角的框塊,以前實(shí)現(xiàn)的時(shí)候都是用圖片做背景之類的方法,那種方法對(duì)于少數(shù)的還是比較可行的,但是當(dāng)涉及到整個(gè)項(xiàng)目都要用 到這樣的效果時(shí)就顯得不夠優(yōu)化和簡練了。2009-12-12
JQuery中使用.each()遍歷元素學(xué)習(xí)筆記
這篇文章主要介紹了jquery中使用.each()遍歷元素學(xué)習(xí)筆記,本文從實(shí)際項(xiàng)目經(jīng)驗(yàn)總結(jié)而來,需要的朋友可以參考下2014-11-11
jQuery取得設(shè)置清空select選擇的文本與值
這篇文章主要介紹了jQuery如何取得設(shè)置清空select選擇的文本與值,下面有個(gè)不錯(cuò)的示例,需要的朋友可以參考下2014-07-07

