How to update jstree node values without reload
for deleting the node and reload tree
$('#mytree').jstree(true).refresh();
for those who need to redraw without restart the tree use
jQuery('#data').jstree(true).refresh(true);
What you need is not refresh()
but redraw()
thus the code is
$('#mytree').jstree(true).settings.core.data = new_data;
$('#mytree').jstree(true).redraw(true);
You can find the functions in the jstree API.
As per zmirc suggestion, in v3.1 use:
$('#mytree').jstree(true).settings.core.data = new_data;
$('#mytree').jstree(true).refresh();
worked for me: $('#structureRows').jstree("destroy").empty();
function CreateStructureTree(jsonData)
{
$('#structureRows').jstree("destroy").empty();
$('#structureRows').jstree
({
'core' : {
'data':
[
jsonData,
{
'id' : 'node_2',
'text' : 'Root node with options',
'state' : { 'opened' : true, 'selected' : true },
'children' : [ { 'text' : 'Child 1' }, 'Child 2']
}
]
}
});
}