Artur Keyan Artur Keyan - 4 months ago 144
Javascript Question

parameters of jstree create_node

Could you please give me the list of parameters of this function and an example of usage

$('#treepanel').jstree("create_node");

Answer

IMHO jsTree is powerful, but documentation could be amazingly better.

The create_node function is documented here.

Be careful not interpreting the [] as a literal. They are just to indicate that the parameters are optional.

This works for jsTree version "pre 1.0 fixed":

var position = 'inside';
var parent = $('#your-tree').jstree('get_selected');
var newNode = { state: "open", data: "New nooooode!" };
$('#your-tree').jstree(
    "create_node", parent, position, newNode, false, false);
Comments