I'm using jQuery FileTree. After a file upload via javascript ajax (old school javascript xmlhttp request, not jQuery), I invoke the fileTree using the following code:
$('#jstree').fileTree({
script: '/ajax/file_tree2/' + path,
multiFolder: true,
expandSpeed: 250,
collapseSpeed: 250
});
...which produces a nice graphic file tree that I can click around in (the path
variable is the new folder, being used as a URI segment variable, and I've simply copied the server-side connector jQueryFileTree.php code into a public function in a CodeIgniter controller class. This is extra information that I don't think has anything to do with the problem, just FYI).
But, for some reason when I make a second call by uploading a new file (without having to reload the page), the file tree doesn't update or refresh. I want to refresh the tree structure when I upload new files for different folders.
I've tried to clear the #jstree element itself, using a loader gif:
$('#jstree').html('<img src=\"'+$("#base_url").html()+'/assets_/images/loading/loading36.gif\" />');
...or even just clearing the html:
$('#jstree').html('');
I've tried commands that are part of other widget-type libraries, like 'destroy' or 'refresh':
$('#jstree').fileTree.destroy();
$('#jstree').fileTree({
refresh: true,
script: '/ajax/file_tree2/' + path,
multiFolder: true,
expandSpeed: 250,
collapseSpeed: 250
});
These either do nothing or return a js error.