Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1145
Expand and Collapse when node clicked
posted

How can I make the node expand/collapse when the user clicks on the parent node text and not just on the expander triangle?

I tried adding:

            nodeClick: function(evt, ui) {
                $("#myTree").igTree("toggle", ui.node);
            }

But it gives me the error: "TypeError: node.children is not a function"

Obviously I'm doing something wrong.

Parents
  • 5105
    Verified Answer
    Offline posted

    Hi Pete,

    ui.node refers to a node object which contains the element, data and path of the node. The toggle function takes the element as a parameter so change to:

     

                nodeClick: function(evt, ui) {                 

                        $("#myTree").igTree("toggle", ui.node.element);             

                }

    Let me know if you need any additional help!

Reply Children