代码: <input id="depts"> <script type="text/javascript"> $(document).ready(function() { $('#depts').combotree({ url: 'data/depts.json', multiple:true,//复选框 checkbox:true,// cascadeCheck:false//true:选中父节点后下面的所有子节点选中,false:选中父节点后下面的子节点不选中 }); }); </script> 或者 <input id="depts" name="depts" class="easyui-combotree" data-options="url:'data/depts.json',method:'get',required:true,multiple:true,checkbox:true,cascadeCheck:true">
depts.json模拟数据: [ { "children": [ { "id": "11", "text": "二级部门1" },{ "id": "12", "text": "二级部门2" },{ "id": "13", "text": "二级部门3" },{ "id": "14", "text": "二级部门4" } ], "icoCls": "icon-ok", "id": "1", "state": "closed", "text": "部门1" }, { "children": [ { "id": "21", "text": "二级部门5" } ], "icoCls": "icon-ok", "id": "2", "state": "closed", "text": "部门2" }, { "children": [ { "id": "31", "text": "二级部门6" }, { "id": "32", "text": "二级部门7" }, { "id": "33", "text": "二级部门8" } ], "icoCls": "icon-ok", "id": "3", "state": "closed", "text": "部门3" } ]