[SOLVED] [1.0] Doesn't TreePanel support Click event?
New Community Forums available at http://forums.ext.net
 

Coolite Forums

Welcome Guest ( Login | Register )
 
[SOLVED] [1.0] Doesn't TreePanel support...
Subscribe
Last Login: 6/30/2010 9:56:00 PM
Posts: 16,
Posted 6/24/2010 1:41:54 AM

Group: Coolite Early Adopter
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:


<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.
Last Login: 7/14/2010 5:04:03 PM
Posts: 717,
Posted 6/28/2010 11:24:18 AM

Group: Coolite Premium Member & Early Adopter
Hi!  It's hard to tell from your code example what is exactly going wrong.  Here are some tips that can help others debug your issue easier.

1. Run in debug mode and put a breakpoint in the event handler.  Is it breaking?
2. Create a simple code example that anyone can just copy and paste into their project and run to reproduce the problem
3. It seems like you are setting the ID of the new panel to be the same as the treenode.  IDs should be unique.

I have a simple layout in my application where on a treenode click, I add a new tab.  It works fine in version 1.0.
Last Login: 6/30/2010 9:56:00 PM
Posts: 16,
Posted 6/28/2010 10:41:57 PM

Group: Coolite Early Adopter
Hi, jchau.

Thanks for your tips. Actually, I put a break point at the first code-line in the tpnNavigator_Click event. In the debug mode, it is not breaking. That's just what I wondering.

By the way, can you show me your code for troubleshooting? You can put your code here or send me an email. (santon_lee@163.com)

Thank you very much.

Santon Lee.
-----------------
Last Login: 6/30/2010 9:56:00 PM
Posts: 16,
Posted 6/29/2010 1:40:08 AM

Group: Coolite Early Adopter


 


I have solved this problem. The reason why treenode_click event is not triggered is due to the treenode.Href property. I set value for the treenode.Href property, so when clicking the treenode, the new page is opened in the current window direct, NOT trigger the treenode_click event.

This topic can be marked as '[SOLVED]'. Thanks.




 

« Prev Topic | Next Topic »
Reading This Topic
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.
All times are GMT -5:00, Time now is 10:15pm