javascript - How to retrive only parent child and enable expand to get the child? -


need load parent node sake of performance , load children when user clicks on icon, , icon not seem expand when not carry child node. can me?

my code return in json. below:

"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   } ] 

edit jquery below:

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

i figured out answer. hope someone.

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"]         }); 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -