jquery-easyui中的树具备基本的CRUD能力,添加节点主要通过append方法实现。
比如,通过以下代码建立一颗食品树:
?
<div style="width:200px;height:auto;border:1px solid #ccc;"> <ul id="tt" class="easyui-tree" url="tree_data.json"></ul> </div>?
?
现在,想在水果节点中再添加二种水果,可以这样操作:
?
var node = $('#tt').tree('getSelected'); if (node){ var nodes = [{ "id":13, "text":"Raspberry" },{ "id":14, "text":"Cantaloupe" }]; $('#tt').tree('append', { parent:node.target, data:nodes }); }
?
效果图如下:
?
原文及下载地址:http://jquery-easyui.wikidot.com/tutorial:tree3
?
1 楼
code_k
2010-03-29
楼主有没有做过含有checkbox的tree,数据要从后台获取的