Closed tonydilger closed 9 years ago
Yes, I can see that this solution works in your situation.
Perhaps you could also load the tree using getJSON, and then put the data in the tree.
$.getJSON(
'/my_data',
function(data) {
$('#tree1').tree({
data: data.BusinessActivities
});
}
);
thanks, that is how I originally had it implemented.
Problem is I wanted to use "load on demand" where I didn't have the luxury of modifying the data prior to sending it to the tree. Is that possible or should I stick with my current solution for the time being?
I see. If you use load-on-demand, then you cannot load the data yourself. I guess you should stick to your solution.
I think this is related to the issue https://github.com/mbraak/jqTree/issues/180.
Yes #180 would solve this issue when implemented.
The dataFilter option is now added to the dev branch.
I did a slight modification to jqTree for a project we are working that allows us to specify which element to use as the object to populate the tree.
It only works for one level deep but works for what we need.
Added extra option to defaults as follows:
Updated _loadData method as follows:
Callled in code as follows:
This fits our current json returned from the server a snippet below shows the structure:
Is this something that could be added to future versions, as I've only developed something for our solution and will need to add again if updating the library in the future.
Thanks for the great library though, well thought out and lightweight.