Skip to content

Instantly share code, notes, and snippets.

@asuraphel
Created March 5, 2014 11:35
Show Gist options
  • Save asuraphel/9365589 to your computer and use it in GitHub Desktop.
Save asuraphel/9365589 to your computer and use it in GitHub Desktop.
JSTree Ajax fetcher
"json_data" : {
"ajax" : {
// the URL to fetch the data
"url" : "/organization/organizationTree",
//?orgId=${ orgId ? orgId : ""}
// the `data` function is executed in the instance's scope
// the parameter is the node being loaded
// (may be -1, 0, or undefined when loading the root nodes)
"data" : function (n) {
// the result is fed to the AJAX request `data` option
return {
"operation" : "get_children",
"id" : n.attr ? n.attr("id").replace("node_","") : 1
};
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment