Search code examples
javascriptjqueryloadinglazy-evaluationgetorgchart

GetOrgChart - InsertNode without expanding it directly


is it somehow possible to insert a Node with getorgchart.js without expanding the node directly? I want to dynamically insert a node (with the insertNode method). But the node should be collapsed.

Is it maybe somehow possible in the renderEvent or updatedEvent methods? I'm trying to implement a kind of lazy loading feature where the nodes are dynamically loaded + inserted.


Solution

  • I was finally able to insert the node without expanding the node directly. I set the args.node.collapsed attribute to 1 when the node is rendered. So the node is collapsed after rendering.

    function renderNodeEvent(sender, args) {
        args.node.collapsed = 1;
    }
    
    orgChart.insertNode(ID);