javascript/jstree

jstree node_parent.original

nabaro 2016. 9. 28. 17:50


jstree node_parent.original

- original 은 뭔가 뭐길래 안나오나 검색해도

아래 글은 검색도중 data.rslt 가 자주 보여 검색해서 나온 내용인데... 봐도 모르것다...

출처 : http://kangbk35.tistory.com/90

I will try and update the docs with information regarding events. As 
for the data object as a whole (not only data.rslt) (again from the 
core docs): 


           "inst" : /* the actual tree instance */, 
           "args" : /* arguments passed to the function */, 
           "rslt" : /* any data the function passed to the event */, 
           "rlbk" : /* an optional rollback object - it is not always present */ 
}



data.rslt.obj <-- 자주쓰이는거 같은데 난 이게 뭔지 모르겠다.


일단 다시 내가 궁금한 것으로 돌아와서


출처 : https://www.jstree.com/api/#/?f=%24.jstree.defaults.core.check_callback


$.jstree.defaults.core.check_callback

determines what happens when a user tries to modify the structure of the tree
If left as false all operations like create, rename, delete, move or copy are prevented.
You can set this to true to allow all interactions or use a function to have better control.

Examples

$('#tree').jstree({
    'core' : {
        'check_callback' : function (operation, node, node_parent, node_position, more) {
            // operation can be 'create_node', 'rename_node', 'delete_node', 'move_node' or 'copy_node'
            // in case of 'rename_node' node_position is filled with the new node name
            return operation === 'rename_node' ? true : false;
        }
    }
});


이러이러하여 저렇게 쓴다는데 true 나 false로 값이 떨어진단다 - 근데 그건 나도 알겠단 말이지 지금 내가 보고있는 소스에서는


아래와 같아 - 저기서 나는 original이 궁금하다는거지 original이 머길래 이렇게 쓰는걸까 알게되면 아래 글 수정해서 알려드림... 답이 안나와있다면


댓글에 답좀 달아주시면 감사 하겠습니다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
.jstree({
             "core" : {
                 //"multiple" : false,
                 'check_callback'function(operation, node, node_parent, node_position, more) {                     
                    if (operation === "move_node") {
                        
                        var node_level = parseInt($("#"+node.id).attr("aria-level"));
                        
                                                
                        var Mlevel = 0;
                        if(node_parent.id != "#"){
                            Mlevel = parseInt($("#"+node_parent.id).attr("aria-level"));
                        }
                        
                        if(node_level == 1){
                            return false;
                            
                        }else if(node_level == 2){
 
                            if(!node_parent.original){
                                
                                if(Mlevel+1 == node_level){
                                    param = node_parent;
                                    return true;
                                }
                            }
                            return false;
                            
                        }
cs


----------------------------------------------------------2016.09.29.09.55---------------------------------------------------


답을 찾았다 - 그냥 node_parent 를 console.log 에 찍어보니까 그안에 있더라 ~ 머들었는지 본걸 보여주겠다.



매번 뜯어서 머들었는지 봐야겠다. 그럼 이렇게 검색해보고 있지도 안을지도... 없으면 어쩌나