I'm new with jqTree and I'd like to reload the tree after ajax call. I have something like this :
$("select").change(function(){
var url = 'lab.json';
if ($(this).val() === 'RAD') {
url = 'rad.json';
}
$.get(
url,
function(jsonData) {
$("#treedata").tree({data: jsonData});
},
"json"
);
});
The first call is working but for the next ones the tree doesn't update with the new data.
Any idea how to update the tree after initialization ?
Thanks
EDIT :
I found a solution but it's not perfect. If someone has a better solution let me know :)
$("#treebox").empty().append('<div id="treedata"></div>');
$("#treedata").tree({
data: jsonData
});
I have to remove the generated content by jqTree using $.empty() and then initialize jqTree each time I want to update the tree with new data.