728x90
반응형

1. zTree 최하위 여부 체크 방법

1
2
3
4
5
6
7
8
9
// zTree를 초기화
var zTreeObj = $.fn.zTree.init($("#treeView"), setting);
 
var checkNodes = zTreeObj.getCheckedNodes(true);
$.each(checkNodes, function(index, node){
    if (typeof node.children == 'undefined') {
        // 최하위 일때 프로세스
    }
});
cs

 

 

2. zTree 하위까지 update 하기

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$.each(zTreeObj.getNodes(), function(index, node){
    updateChkDisabled(node);
});
 
function updateChkDisabled(node){
    // node 정보 변경 및 update
    node.chkDisabled = true;
    zTreeObj.updateNode(node);
 
    // 재귀함수로 하위 node 정보 변경 및 update
    $.each(node.children, function(index, sNode){
        updateChkDisabled(sNode);
    });
}
cs

 

 

 

* 관련글
[jquery] zTree plugin (tree view) : https://deonggi.tistory.com/110

[jquery, zTree] zTree의 checkbox 사용 : https://deonggi.tistory.com/118

 

 

728x90
반응형

+ Recent posts