vakata/jstree — Issue #140: json_data when using function for data and ajax data function only executed for each tree expantion
Author: CheeseWizzz
Created: 2011-11-30 16:52:23+00:00
State: open

I have created a tree which needs to be initialized based on a local property and then any subsequent branch expansion I need the ajax option to be used. However whenever a function is defined as the value for the data property, only that function is executed on initialization as well as all tree expansions and the ajax property settings are never used.
example changes to the "Using both the data & ajax config options" from the demo documentation for JSON_DATA:
$(function () {
$("#demo4").jstree({
"json_data" : {
"data" : function(aNode, aFunction) {
aFunction($.parseJSON('[{"data" : "A node","state" : "closed"},	{"attr" : { "id" : "li.node.id3" },"data" : {"title" : "Long format demo","attr" : { "href" : "#" }	}}]'));
},
"ajax" : { "url" : "_json_data.json" }
},
"plugins" : [ "themes", "json_data" ]
});
});

Once these changes are made to the demo, the issue is clearly illustrated.