Closed burtondav closed 11 years ago
It depends. Are you loading the data using the data-url option? Or are you using the data option?
data-url: jqTree does not support this; but you can load the data yourself using jquery.ajax
data: I believe you can do the following:
var location_data = {
locations: [
{ label: 'Location1 '},
{ label: 'Etcetera' }
]
};
$('#tree1').tree({
data: location_data['locations']
});
This is my jquery (coffeescript) code: $.getJSON "/locations/tree", (data) -> $("#tree1").tree data: data
I'm using jbuilder in Rails. I've changed my json output to now look like this - but, it doesn't work:
{ label: "1st Level", children: [ { label: "2nd Level", children: [
1) Does it need to start with a [ instead of { ???
2) Should I be using the data-url option? 3) I will try your suggestion - thanks!
I'm trying use jqtree using json data.
The json data input starts out with the table name like this:
Instead of starting with first label.
Is there some way to get jqtree to accept this?
Thanks !!