Search code examples
javascriptjquerybootstrap-treeview

Is there a way to change node text in bootstrap treeview?


Is there a way to change node text in bootstrap treeview without redrawing the whole tree or removing/adding the node?

I checked here: https://github.com/jonmiles/bootstrap-treeview and here: https://github.com/patternfly/patternfly-bootstrap-treeview but there seem to be no method like "updateNode" or "renameNode".


Solution

  • Simply select the node and update its parameters -

    node = $('#tree').treeview('getNode', <nodeId>);
    node.text = '<new value>';
    $('#tree').treeview(true).removeNode([]); // refresh hack available in the development github branch.