PDA

View Full Version : TreePanel issues



cleve
Apr 05, 2012, 4:52 AM
I have the following situations which make me a little bit confused.

1. Works fine, showing two nodes on the panel


<ext:TreeStore runat="server" ID="s" AutoLoad="false" />
<ext:TreePanel runat="server" ID="t" RootVisible="false" Border="false">
<Root>
<ext:Node Text="root">
<Children>
<ext:Node Text="A" Leaf="true" />
<ext:Node Text="B" Leaf="true" />
</Children>
</ext:Node>
</Root>
<Listeners>
<CheckChange Handler="" />
</Listeners>
</ext:TreePanel>


2. Jump to somewhere (in MVC, bound to store "s")


<ext:TreeStore runat="server" ID="s" AutoLoad="false" />
<ext:TreePanel runat="server" ID="t" StoreID="s" RootVisible="false" Border="false">
<Root>
<ext:Node Text="root">
<Children>
<ext:Node Text="A" Leaf="true" />
<ext:Node Text="B" Leaf="true" />
</Children>
</ext:Node>
</Root>
<Listeners>
<CheckChange Handler="" />
</Listeners>
</ext:TreePanel>


3. Works fine (only one node as the root)


<ext:TreeStore runat="server" ID="s" AutoLoad="false" />
<ext:TreePanel runat="server" ID="t" RootVisible="true" Border="false">
<Root>
<ext:Node Text="root" />
</Root>
<Listeners>
<CheckChange Handler="" />
</Listeners>
</ext:TreePanel>


4. Jump to somewhere (root visible set to false).


<ext:TreeStore runat="server" ID="s" AutoLoad="false" />
<ext:TreePanel runat="server" ID="t" RootVisible="false" Border="false">
<Root>
<ext:Node Text="root" />
</Root>
<Listeners>
<CheckChange Handler="" />
</Listeners>
</ext:TreePanel>


Can I have an explanation on these? Particularly on:
1. What's the reason to make it jump (loader or proxy behavior?)
2. Can treestore work in memory mode which accepts the data from json string? any examples?

Cheers.

Daniil
Apr 09, 2012, 1:15 PM
1. What's the reason to make it jump (loader or proxy behavior?)

Could you provide a full sample to reproduce the problem?


2. Can treestore work in memory mode which accepts the data from json string? any examples?

To load nodes please use the Node appendChild method.

TreePanel1.getRootNode().appendChild({
id : "node1",
text : "node",
leaf : true
});


Then you will be able to get this node from a TreeStore:


TreePanel1.getStore().getNodeById("node1")