$("#workNodeCodes").tree({
url: baseURL+'template/getWorkNode?templateTableId='+templateTableId,
width: '100%',
onlyLeafCheck: false,
checkbox:true,
cascadeCheck:true,
onBeforeCheck: function (node) {
if (node.disabled) {
return false;
}
},
onSelect:function(node){
if(node.checkState=="unchecked"){
$("#workNodeCodes").tree("check",node.target);
}else{
$("#workNodeCodes").tree("uncheck",node.target);
}
},
onLoadSuccess:function () {
if(templateTableId){
$.post(baseURL+'template/getSelectedWorkNode',{"templateTableId":templateTableId},function (res) {
if(res){
for(var i=0;i<res.length;i++) {
var node = $("#workNodeCodes").tree("find", res[i].work_node_code);
$("#workNodeCodes").tree("check", node.target);
}
}
})
}
}
})
```