First of all thanks for your work ! JSTree is a very nice plugin. :)
But now I have problems.I can't configure JSTree in order to make AJAX
request to the HTTP handler.
See configuration below:
$("#" + treeID).jstree({
json_data: {
ajax: {
async: true,
url: GetHTTPHandlerUrl("RemoteServerFSHandler.ashx"),
dataType: "json",
type:"GET",
success: function() { alert("SUCCESS"); },
error: function(XMLHttpRequest, textStatus, errorThrown)
{ debugger; }
}
}
,
plugins: ["json_data", "themes", "ui"],
I always receive error:
This method cannot be called until the send method has been called.
Don't sure if it's error in JQuery 1.4.1 or in JSTree.
Thanks in advance!
I've managed to make the tree works async with AJAX+JSON..here is my
config
jQuery("#jstree_1").jstree({
json_data : {
async : true,
ajax : {
url : URL_AJAX, //"./data.json",
dataType : "json",
data : function (n) {
return { "id" : n == -1 ? 0 :
n[0].id };
}
}
},
themes : { theme: "default", dots : true },
plugins : [ "json_data", "themes", "ui", "search" ],
search : {
//search still doesn t work
}
}
});
URL_AJAX is an url pointint to a server that will receive an id, and
send back (as in v 0.9.9a) a list of child nodes.
The syntax has slightly changed, due I think to Jquery 1.4.
attributes are now called attr, and every name of json attribute must
be enclosed in double quotes..
[
{ "attr": {"id" : "n1"}, "data": "Nodo 1 Pesce", "state": "closed"}
,{ "attr": {"id" : "n2"}, "data": "Nodo 2 Carne", "state": "closed"}
,{ "attr": {"id" : "n3"}, "data": "Nodo 3 Verdura", "state": "closed"}
,{ "attr": {"id" : "n4"}, "data": "Nodo 4 Frutta ", "state": "closed"}
]
Here is a working snippet..
Hope it helps
regards
Walter
On Feb 8, 2:01 pm, "denis.kolkovskiy" <denis.kolkovs...@itechart-
Cheers,
Ivan