Dec 08, 2014, 6:59 PM
[CLOSED] TreePanel not loading nested nodes.
On version 2.x, the TreePanel loads nested nodes as expected
But on version 3.x it stopped working
It seems to be something related to TreeStore's LazyFill property, because on version 2.x, when TreeStore's LazyFill property is set to true, it behaves like on version 3.x.
But on version 3.x it stopped working
It seems to be something related to TreeStore's LazyFill property, because on version 2.x, when TreeStore's LazyFill property is set to true, it behaves like on version 3.x.
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:TreePanel RootVisible="false" Title="Ext.Net" Height="300" Width="500"
Margins="10" Border="false" runat="server">
<Store>
<ext:TreeStore runat="server" LazyFill="false">
<Proxy>
<ext:AjaxProxy Url="/Example/LoadTreeFakeChildren">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader IDProperty="ID" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="ID" Type="Int" />
<ext:ModelField Name="Name" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:TreeStore>
</Store>
<Root>
<ext:Node NodeID="0" Text="Root" />
</Root>
<ColumnModel>
<Columns>
<ext:Column Text="ID" DataIndex="ID" runat="server" />
<ext:TreeColumn Text="Name" DataIndex="Name" Flex="2" runat="server" />
</Columns>
</ColumnModel>
</ext:TreePanel>
</body>
</html>
public class ExampleController : System.Web.Mvc.Controller
{
public ActionResult Index2()
{
return View();
}
public ActionResult LoadTreeFakeChildren()
{
NodeCollection nodes = new NodeCollection(false);
Node node = new Node
{
NodeID = 1.ToString()
};
node.CustomAttributes.Add(new ConfigItem { Name = "ID", Value = node.NodeID, Mode = ParameterMode.Raw });
node.CustomAttributes.Add(new ConfigItem { Name = "Name", Value = "Ext.Net", Mode = ParameterMode.Value });
node.CustomAttributes.Add(new ConfigItem { Name = "loaded", Value = "true", Mode = ParameterMode.Raw });
node.CustomAttributes.Add(new ConfigItem { Name = "expanded", Value = "true", Mode = ParameterMode.Raw });
nodes.Add(node);
Node childNode = new Node
{
Leaf = true,
NodeID = 2.ToString()
};
childNode.CustomAttributes.Add(new ConfigItem { Name = "ID", Value = childNode.NodeID, Mode = ParameterMode.Raw });
childNode.CustomAttributes.Add(new ConfigItem { Name = "Name", Value = "Sencha", Mode = ParameterMode.Value });
//Add child
node.Children.Add(childNode);
return Content(nodes.ToJson());
}
}
Last edited by Daniil; Dec 11, 2014 at 7:37 AM.
Reason: [CLOSED]