Sep 07, 2012, 9:28 AM
[CLOSED] Treepanel dynamic loading with autoexpand
Hi,
I have a treepanel that loads root node and autoexpand these nodes calling server for its childs.
But in v2.1 I'm having an internal error that I can't solve.
This is the test case to try it:
CONTROLLER
I have a treepanel that loads root node and autoexpand these nodes calling server for its childs.
But in v2.1 I'm having an internal error that I can't solve.
This is the test case to try it:
CONTROLLER
public ActionResult TreeList()
{
Ext.Net.NodeCollection nodeCollection = new Ext.Net.NodeCollection();
var id = Convert.ToInt32(Request["node"]);
if (id == 0)
{
for (int i = 0; i < 5; i++)
{
Ext.Net.Node parentNode = new Ext.Net.Node
{
NodeID = i.ToString(),
Text = string.Format(HttpUtility.HtmlEncode("[Parent] Text Node {0}"), i),
Leaf = false,
Expandable = true,
Qtip = string.Format(HttpUtility.HtmlEncode("[Parent] Tooltip node {0}"), i),
Expanded = true
};
nodeCollection.Add(parentNode);
}
}
else
{
for (int j = 0; j < 10; j++)
{
Ext.Net.Node childNode = new Ext.Net.Node
{
NodeID = string.Format("{0}.{1}", id, j),
Text = string.Format(HttpUtility.HtmlEncode("[Child] Text Node {0}.{1}"), id, j),
Leaf = true,
Expandable = false,
Qtip = string.Format(HttpUtility.HtmlEncode("[Child] Tooltip node {0}.{1}"), id, j),
Expanded = false
};
nodeCollection.Add(childNode);
}
}
return Content(nodeCollection.ToJson());
}
ASPX<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:TreePanel ID="treePanelListados" runat="server" Layout="FitLayout" Border="false"
RootVisible="false" AutoScroll="true">
<View>
<ext:TreeView runat="server" LoadingUseMsg="false" LoadMask="false" TrackOver="true" />
</View>
<Store>
<ext:TreeStore runat="server">
<Proxy>
<ext:AjaxProxy Url="/Area/Controller/TreeList" />
</Proxy>
</ext:TreeStore>
</Store>
<Root>
<ext:Node NodeID="0" />
</Root>
</ext:TreePanel>
</body>
</html>
Last edited by Daniil; Sep 07, 2012 at 1:58 PM.
Reason: [CLOSED]