PDA

View Full Version : How to have a root node in a JSON TreeStore.



sssml2011
25 Jan 2012, 3:47 PM
How do I need to format the JSON data for a TreeStore where I want the JSON data to populate the root node of a tree.Panel?  I can create JSON that populates a tree.Panel with rootVisible=false, but, when I add a root object to the JSON and set rootVisible=true the tree doesn't populate at all.  There are no errors, it just doesn't show anything.

It works when I set the "root" property, as in this example: http://docs.sencha.com/ext-js/4-0/guides/tree/examples/simple_tree/index.html.  But using the same JSON with an AJAX proxy, as in the check-tree example (http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/tree/check-tree.html), it doesn't populate the tree.

jay@moduscreate.com
25 Jan 2012, 4:01 PM
I think that's because the tree store needs to be initialized with the root object.

sssml2011
26 Jan 2012, 2:01 AM
Thanks for the tip. I have attached the example solution for others that need it.