javascriptjqueryfancytree

Fancytree trigger load programmatically


I am using fancytree in my project and I want to trigger the lazy loading of a node programmatically and also want to add a callback. How can I do that?


Solution

  • In order to load a lazy node you can call node.load():

    node.load().then(function() {
        // do something when children have loaded
    })
    

    Also, all load operations trigger the loadChildren event:

    loadChildren: function(event, data) {
        // data.node has new children now
    },