localzuk Posted October 14, 2013 Posted October 14, 2013 I am creating a tree for use with jstree (this is a test set of data, the actual program will create the data on the fly). However, this data seems to be showing as recursive... Why would this be? [ { "data":"Year 5", "attr":{ "id":"1", "rel":"year" }, "children":[ { "data":"5AM", "state":"closed", "children":[ { "data":"Pupil", "state":"closed", "attr":{ "id":"2", "rel":"pupil" } } ], "attr":{ "id":"2", "rel":"class" } }, { "data":"5BA", "state":"closed", "attr":{ "id":"3", "rel":"class" } }, { "data":"5CZ", "state":"closed", "attr":{ "id":"4", "rel":"class" } } ] } ]
localzuk Posted October 14, 2013 Author Posted October 14, 2013 Well, this isn't the 'right' fix but it works. Setting the "state" of any childless node to "leaf" stops the recursion. Makes it annoying for generating the JSON though!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now