I would really appreciate some help with the following:
I have a jsTree loaded with JSON data via a URL. All the data is preloaded.
What I need to do is change the search functionality to reload the entire tree with new JSON data via AJAX based on the user input (because I need to do more complex node searching in the backend).
As a start all I am trying to do is to get the jsTree code to call my URL. I started with the same URL as I use to originally load the tree.
However - and this is the problem for which I cannot find a solution - although the URL is called successfully to first load the tree, when I type some search text and click "Search", jsTree uses its normal internal search to highlight nodes, but the URL I provide is never called again.
The HTML is
Search
Clear
The jsTree initialization that I am using is:
var url = ;
$("#myJsTree").jstree({
"json_data" : {
async : true,
"ajax" : {
"url" : url
}
},
"search": {
"case_insensitive" : true,
"ajax" : {
"url" : url
}
},
'ui' : {
'select_limit' : 1,
'initially_selected' : [${myId}],
},
"plugins" : [ "json_data", "search", "sort", "ui", "themeroller" ],
});
And the snippet of search code:
$("#searchTree").click(function() {
$("#myJsTree").jstree("search", $("#treeSearchText").val());
return false;
});
I would really appreciate any help.
Thanks.