Jun 24, 2010, 5:41 AM
[CLOSED] [1.0] Doesn't TreePanel support Click event?
Hi,
I'm studying coolite 1.0. Glad to know control can be created from code-behind, and there are some examples online.
What I want to do is using a treepanel and a tabpanel to accomplish the system functions navigation. As to the detail, when clicking the treenode(leaf), adding a new tab in the tabpanel and autoload the page. But I found the new page can not be opened in the tabpanel control, it is opened in the window directly. I debug the code and found that the click event was not executed at all. What I want to know is whether treepanel support click event. If supported, what's wrong with my code. The following is the code:
I'm studying coolite 1.0. Glad to know control can be created from code-behind, and there are some examples online.
What I want to do is using a treepanel and a tabpanel to accomplish the system functions navigation. As to the detail, when clicking the treenode(leaf), adding a new tab in the tabpanel and autoload the page. But I found the new page can not be opened in the tabpanel control, it is opened in the window directly. I debug the code and found that the click event was not executed at all. What I want to know is whether treepanel support click event. If supported, what's wrong with my code. The following is the code:
<West Collapsible="true" Split="true" MaxWidth="200px">
<ext:TreePanel ID="tpnNavigator" runat="server" AutoHeight="True" RootVisible="False" Width="200px" Icon="ApplicationViewList">
<DirectEvents>
<Click OnEvent="tpnNavigator_Click">
<ExtraParams>
<ext:Parameter Name="paraFunID" Value="node.id" Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:TreePanel>
</West>
protected void tpnNavigator_Click(object sender, DirectEventArgs e)
{
//string strFunID = tpnNavigator.ActiveTab.ID; SEEMS CANN'T GET THE RIGHT VALUE!!!
string strFunID = e.ExtraParams["paraFunID"].ToString();
bool Existed = false;
//tpList is the ID of the tabpanel control
foreach (Ext.Net.Component li in tpList.Items)
{
if (li.ID == strFunID)
{
Existed = true;
break;
}
}
if (Existed)
{
tpList.SetActiveTab(strFunID);
}
else
{
SysFunctions objFun = SysFunctions.SelectByFunID(strFunID);
Ext.Net.Panel pnl = new Ext.Net.Panel();
pnl.ID = "TAB_" + strFunID;
pnl.Title = objFun.FunName;
pnl.AutoLoad.Url = objFun.FunURL;
pnl.AutoLoad.Mode = LoadMode.IFrame;
pnl.Render(tpList, RenderMode.AddTo);
//pnl.AddTo(tpList);
tpList.SetActiveTab(strFunID);
}
}
Please check the code above. THANKS A LOT.