2014-09-10 1 views
0

성능 향상을 위해 부모 노드 만로드 한 다음 사용자가 아이콘을 클릭 할 때 하위 노드를로드해야하며 자식 노드를 가지고 있지 않으면 아이콘이 확장되지 않는 것 같습니다. 누구든지 나를 도울 수 있습니까?부모 자식 만 검색하고 확장을 사용하여 자식을 얻는 방법?

내 코드는 json으로 반환됩니다. 아래 :

"JsonData": [ 
    { 
    "id": "13", 
    "text": "MainBox", 
    "parent": "#", 
    "state": { 
     "opened": false, 
     "disabled": false, 
     "selected": false 
    }, 
    "children": false, 
    "icon": null, 
    "li_attr": "{class = 'jstree-leaf' }", 
    "a_attr": null 
    } 
] 

편집 내 JQuery와 아래 :

root = $('#tree-files').jstree({ 
     'core': { 
      'data': //code before  
     }, 
     "plugins": ["themes", "json_data", "ui", "contextmenu"] 
    }); 
+0

jQuery 코드는 어디에 있습니까? 당신이 무엇을하려고하는지 잘 모르겠다 – tymeJV

+0

@tymeJV 내 코드를 편집했는데 코드에 오류가 없지만 열린 자식 노드의 기능을 수행 할 수 없다 –

+0

작동하는 바이올린을 제공하십시오. – denisol

답변

0

내가 답을 알아 냈어. 나는 누군가를 도울 수 있기를 바랍니다.

root = $('#tree-files').jstree({ 
     'core': { 
      'data': { 
       'url': function (node) { 
        return 'Action/Controller'; 
       }, 
       'headers': headers, 
       'xhrFields': { withCredentials: true }, 
       'async': true, 
       'data': function (node) { 
        //handler params here 
        return { 'id': node.id } ; 
       }, 
       success: function (dados) { 
        //code success here 
       } 
      }, 
      "check_callback": true, 
      "themes": { 
       "theme": "default", 
       "dots": false, 
       "icons": true, 
      }, 
     }, 
     "plugins": ["themes", "json_data", "ui", "contextmenu", "crrm"] 
     });