PDA

View Full Version : [CLOSED] [2.0] TreePanel



Timothy
May 29, 2012, 2:28 PM
Hello,

I've got the following example and I would like it to preload all of the children without doing async calls back to the server. I use to use the TreeLoader PreloadChildren property. I cannot find the equivalent now?



Html.X().TreePanel()
.Border(false)
.Collapsible(true)
.Lines(false)
.RootVisible(false)
.UseArrows(true)
.Width(255)
.Store(store =>
store.Add(Html.X().TreeStore()
.Proxy(proxy =>
proxy.Add(Html.X().AjaxProxy()
.Reader(reader =>
reader.Add(Html.X().JsonReader()
.Root("Data")
)
)
.Url(Url.Action("GetAll", "Node"))
)
)
)
)


Here is the response from Node/GetAll:




[ { "children": [ { "children": [], "text": "Folder 1" }, { "children": [], "text": "Folder 2" }, { "children": [], "text": "Folder 3" } ], "text": "Root" }]


Cheers,
Timothy

Daniil
May 29, 2012, 5:41 PM
Hi,

The first moment. Please don't override the Root of JsonReader when you deal with TreeStore. It should stay "children" by default. So, please remove JsonReader. TreeStore expects an array of nodes in a response without any additional prefix like "data" in your case. Respectively, please replace the loadNodeChildren action with the following one.

Regarding to the PreloadChildren option.

I have found this:
http://www.sencha.com/forum/showthread.php?151706&p=663078&viewfull=1#post663078
and, generally, agree with the suggestion.

Timothy
May 29, 2012, 6:47 PM
Hi,
Respectively, please replace the loadNodeChildren action with the following one.

...


Which one? :)

Cheers

Daniil
May 29, 2012, 6:53 PM
It is a copy/paste error:) This phrase should not be in that post.

To clarify I have copied it from this post:
http://forums.ext.net/showthread.php?19254&p=82957&viewfull=1#post82957

Generally, it might be helpful for you as well.

Timothy
May 29, 2012, 7:05 PM
Thanks! Please mark as closed :)

Cheers,
Timothy