How to change the icon when 'itemclick' TreePanel?

  1. #1

    How to change the icon when 'itemclick' TreePanel?

    Code:
     
    X.TreePanel().Width(300)
                                .Listeners(l=>{ 
                                    l.ItemClick.Handler="???";
                             })
                            .Root(
                                X.Node().Text("Root").NodeID("node_0").Icon(Icon.Page)
                                .Children(
                                    X.Node().Text("childNode_1").NodeID("node_1").Leaf(true).Icon(Icon.ControlBlankBlue),
                                     X.Node().Text("childNode_2").NodeID("node_2").Leaf(true).Icon(Icon.ControlBlankBlue),
                                      X.Node().Text("childNode_3").NodeID("node_3").Leaf(true).Icon(Icon.ControlBlankBlue)
                                )
                        )
    click "node_1" change "Icon.ControlBlankBlue" to "Icon.ControlStopBlue"

    How do I do?
  2. #2
    Hello!

    Please, look at the following sample:

    <%@ Page Language="C#" %>
    
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    <script runat="server">
        public void Page_Load(object sender, EventArgs e)
        {
            ResourceManager.GetInstance().RegisterIcon(Icon.ControlStopBlue);
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET Examples</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
       
        <ext:TreePanel runat="server" ID="TreePanel1">
            <Root>
                <ext:Node Text="Root" Icon="Page">
                    <Children>
                        <ext:Node Text="childNode_1" Leaf="True" Icon="ControlBlankBlue"></ext:Node>
                        <ext:Node Text="childNode_2" Leaf="True" Icon="ControlBlankBlue"></ext:Node>
                        <ext:Node Text="childNode_3" Leaf="True" Icon="ControlBlankBlue"></ext:Node>
                    </Children>
                </ext:Node>
            </Root>
            <Listeners>
                <ItemClick Handler="
                    record.set('iconCls', '#ControlStopBlue')
                    "></ItemClick>
            </Listeners>
        </ext:TreePanel>
    </body>
    </html>
  3. #3
    thank you !

Similar Threads

  1. [CLOSED] TreePanel With Image/Icon
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 17, 2013, 7:25 AM
  2. [CLOSED] Custom atributes of Treepanel's nodes on Itemclick listener
    By profitsistemas in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 23, 2013, 11:12 AM
  3. [CLOSED] TreePanel itemClick DirectEvent
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Oct 26, 2012, 4:53 AM
  4. Replies: 2
    Last Post: Jul 30, 2010, 12:37 AM
  5. Treepanel - No Icon - Just Checkbox
    By Tbaseflug in forum 1.x Help
    Replies: 1
    Last Post: Nov 09, 2009, 4:22 PM

Posting Permissions