I am loading XML flat tree in my jsTree using ajax, so the declaration looks like this (it works fine):
$("#jstree").jstree({ "xml_data": { // "data": $xmlFlatData, "ajax": { type: "POST", async: true, "url": loc + "/AjaxReturnTree", data: '{"longnames":"'+flag+'"}', contentType: "application/json; charset=utf-8", dataType: "json", cache: false, success: function (msg) { var mm = eval('(' + msg + ')'); ; // create object to get rid of json return mm.d; }, error: function () { // TODO process error } }, "xsl": "flat", "override_ui": "true", "real_checkboxes": "true" }, "plugins": ["xml_data", "themes", "checkbox", "ui"] });
Now I need to reload the tree AND change the "longnames" part to another flag (it's either 0/1), but keep other options unchanged.
I am trying to use something like this:
$("#jstree").jstree({ "xml_data": { "ajax": { cache: false, data: '{"longnames":"' + flag + '"}' } } }); $("#jstree").jstree("refresh");
But it does not trigger new AJAX request, only refreshes the tree on screen without reload.
How I can get tree to reload from server?
Also, how I can be sure that I change properties of old ajax setup, not creating a completely new tree object?