Reputation: 653
I want to create a new node inside a node when you click on its last children.
I tried the following script, but it always returns false instead of the new node id.
$('#categories').jstree().create_node('#', 'Foo');
This is the same code with a different syntax, but this isn't working either:
$('#categories').jstree().create_node('#', {data:'Foo'});
And these are also the same:
$('#categories').jstree('create_node', '#', {data:'Foo'});
$('#categories').jstree('create_node', '#', 'Foo');
Upvotes: 1
Views: 4504
Reputation: 5061
You have to add "check_callback": true
to your tree config like below.
Check demo - Fiddle demo.
$("#categories").jstree({
"core": {
"data": ...,
"check_callback": true
}
});
Upvotes: 8