May 15, 2012, 2:15 PM
[CLOSED] Trigger the loading of TreePanel´s data
Hi folks, in the following example the load of root node´s content occurs when it is expanded. If i set the rootVisible property to false the "root" nodes are loaded automatically. I would like to know whether it´s possible to control the load of "root" nodes when rootVisible property is set to false. In other works i want that to load the data just when the button "_btn" is clicked, but without show root node.
1 - View
1 - View
<ext:Button ID="_btn" Text="add" runat="server">
<Listeners>
<Click Handler="doLoad();" />
</Listeners>
</ext:Button>
<ext:TreePanel ID="TreePanel1" runat="server" Title="Tree" Height="500" Width="200"
Border="false">
<Store>
<ext:TreeStore ID="TreeStore1" NodeParam="nodeId" runat="server">
<Proxy>
<ext:AjaxProxy Url="/Example/loadNodeChildren">
<Reader>
<ext:JsonReader Root="data" />
</Reader>
</ext:AjaxProxy>
</Proxy>
</ext:TreeStore>
</Store>
<Root>
<ext:Node NodeID="0" Text="Ext" />
</Root>
</ext:TreePanel>
2 -Controllerpublic StoreResult loadNodeChildren(string nodeId)
{
NodeCollection nodes = new NodeCollection(false);
if (!string.IsNullOrEmpty(nodeId))
{
for (int i = 1; i < 6; i++)
{
Node asyncNode = new Node();
asyncNode.Text = nodeId + i;
asyncNode.NodeID = nodeId + i;
nodes.Add(asyncNode);
}
}
return new StoreResult { Data = nodes.ToJson() };
}
3 - JavaScriptvar doLoad = function () {
//Trigger load
}
Last edited by Daniil; May 18, 2012 at 5:01 PM.
Reason: [CLOSED]