dimanche 15 février 2015

How to refreseh jsTree with new JSON data?


I have a file upload element which upon change, scans the file names and does something to get a VALID treeJSON variable (I've checked, my function works.). Now when the function detects a change the second time, obviously treeJSON is going to update and I want it to update the tree. I've tried various methods such as , refresh(), destroy() etc. But I havn't been able to contrust a new tree in the same page WITHOUT a page reload upon input.onchange.


Here is a snippet. I'vn't included all the functions. It works. Improtant part is working with the treeJSON



input.onchange = function (e) {
\\ something
}
var treeJSON = someVar;


$('#tree').jstree({ 'core' : {
'check_callback' : true,
'data' : treeJSON
} });


Any help is appreciated! Thanks





Aucun commentaire:

Enregistrer un commentaire