Hi,
I need to add an event to fire when I click over a TreeNode. The idea is when I click on a node, it lauched an event for load child nodes of these node by demand.
I have the idea in html code, but now I need to create these by code.
<ext:Accordion ID="Accordion1" SkinID="lytLeftSideBar" Animate="true" runat="server">
<ext:TreePanel ID="TreePanel1" SkinID="treeOptions" runat="server" Title="Favorite Options">
<Root>
<ext:TreeNode Text="Composers1">
<Nodes>
<ext:TreeNode Text="Option1"></ext:TreeNode>
<ext:TreeNode Text="Option2"></ext:TreeNode>
<ext:TreeNode Text="Option3"></ext:TreeNode>
<ext:TreeNode Text="Option4"></ext:TreeNode>
</Nodes>
</ext:TreeNode>
</Root>
</ext:TreePanel>
<ext:TreePanel ID="TreePanel2" SkinID="treeOptions" runat="server" Title="Products">
<Root>
<ext:TreeNode Text="Composers2">
<Nodes>
<ext:TreeNode Text="Option 5" />
<ext:TreeNode Text="Option 6" />
<ext:TreeNode Text="Option 7" />
</Nodes>
</ext:TreeNode>
</Root>
</ext:TreePanel>
</ext:Accordion>
But I don't know how to fires an event that load by demand the child nodes (option1, option 2, etc.) when I click over the parent nodes (Composers1 and Composers2).
I just have the next code, where Menu is an own class that have some properties like:
int parent; int level; int option; string name; int transactionNumber; string url; string image; string description; string order;
And the method is:
public void ShowMenu(List<Menu> dataMenu)
{
List<Menu> menuList = dataMenu;
if (menuList != null)
{
Accordion accordion1 = new Accordion();
accordion1.ID = "Accordion1";
accordion1.SkinID = "lytLeftSideBar";
foreach (Menu item in menuList)
{
TreePanel panel = new TreePanel();
panel.Title = item.Name;
panel.SkinID = "treeOptions";
root = new Coolite.Ext.Web.TreeNode("Composers1");
root.Expanded = false;
root.AllowChildren = true;
panel.Root.Add(root);
accordion1.Items.Add(panel);
}
Panel1.BodyControls.Add(accordion1);
}
}