easyui的tree节点的获取和选中
easyui的tree节点的获取和选中
学习了:http://www.cnblogs.com/fanyf/p/6863212.html
function txtICDKeyup001(e){ if(e.keyCode==13){ // 输入回车之后进行查询 $('#txtICD').attr('disabled','disabled'); // 暂时禁用 $('#txtICD').removeAttr('disabled'); $('#divTreeId').tree({ data : [ { "id" : 1, "text" : "Folder1", "iconCls" : "icon-save", "children" : [ { "id":2, "text" : "File1" }, { "id":3, "text" : "Books", "state" : "closed", "children" : [ { "id":4, "text" : "PhotoShop" , state:'open' }, { "id" : 8, "text" : "Sub Bookds", "state" : "closed" } ] } ] }, { "text" : "Languages", "state" : "closed", "children" : [ { "text" : "Java" }, { "text" : "C#" } ] } ] , idField:"id", treeField:"code", animate:true, lines:true, "checkbox":true, onlyLeafCheck:true, title:'title...' }); var node = $('#divTreeId').tree('find', 4);//找到id为”tt“这个树的节点id为”1“的对象 $('#divTreeId').tree('expandTo', node.target); $('#divTreeId').tree('select', node.target);//设置选中该节点 } }