CommandColumn and DirectEvents

  1. #1

    CommandColumn and DirectEvents

    How to using CommandColumn and DirectEvents??
  2. #2
    Hello!

    Welcome to our forum!

    Please, take a look at the following example:

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <script runat="server">
            protected void GridCommand(object sender, DirectEventArgs e)
            {
                X.Msg.Alert("Command", "Command have been pressed").Show();
            }
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:TreePanel 
                ID="TreePanel1" 
                runat="server" 
                Title="My Task List"
                Icon="Accept"
                Height="400"
                Width="250"
                UseArrows="true"
                AutoScroll="true"
                Animate="true"            
                HideHeaders="true"
                RootVisible="false">
                <Root>
                    <ext:Node>
                        <Children>
                            <ext:Node Text="To Do" Icon="Folder" Expanded="true">
                                <Children>
                                    <ext:Node Text="Go jogging" Leaf="true" />
                                    <ext:Node Text="Take a nap" Leaf="true" />
                                    <ext:Node Text="Clean house" Leaf="true" />
                                </Children>
                            </ext:Node>
                            
                            <ext:Node Text="Grocery List" Icon="Folder" Expanded="true">
                                <Children>
                                    <ext:Node Text="Bananas" Leaf="true" />
                                    <ext:Node Text="Milk" Leaf="true" />
                                    <ext:Node Text="Cereal" Leaf="true" />
                                    
                                    <ext:Node Text="Energy foods" Icon="Folder" Expanded="true">
                                        <Children>
                                            <ext:Node Text="Coffee" Leaf="true" />
                                            <ext:Node Text="Red Bull" Leaf="true" />
                                        </Children>
                                    </ext:Node>
                                </Children>
                            </ext:Node>
                            
                            <ext:Node Text="Kitchen Remodel" Icon="Folder" Expanded="true">
                                <Children>
                                    <ext:Node Text="Finish the budget" Leaf="true" />
                                    <ext:Node Text="Call contractors" Leaf="true" />
                                    <ext:Node Text="Choose design" Leaf="true" />
                                </Children>
                            </ext:Node>
                        </Children>
                    </ext:Node>
                </Root>
                
                <ColumnModel>
                    <Columns>
                        <ext:TreeColumn runat="server" Flex="1" DataIndex="text" />
                        <ext:CommandColumn runat="server" Width="40">
                            <Commands>
                                <ext:GridCommand CommandName="Edit" Icon="PageWhiteEdit" ToolTip-Text="Edit task" />
                            </Commands>
                            <PrepareToolbar Handler="return record.data.leaf;" />
                            <DirectEvents>
                                <Command OnEvent="GridCommand"></Command>
                            </DirectEvents>
                        </ext:CommandColumn>
                    </Columns>
                </ColumnModel>
             </ext:TreePanel>
        </form>
    </body>
    </html>

Similar Threads

  1. [CLOSED] CommandColumn how to set Css??
    By gs_user in forum 2.x Premium Help
    Replies: 2
    Last Post: Nov 29, 2012, 5:22 AM
  2. [CLOSED] CommandColumn and DirectEvents
    By Stefanaccio in forum 1.x Premium Help
    Replies: 3
    Last Post: Aug 26, 2010, 10:45 AM
  3. CommandColumn in codebehind
    By roszman in forum 1.x Help
    Replies: 0
    Last Post: Apr 28, 2010, 10:42 AM
  4. Help. regarding commandcolumn
    By ydnah2 in forum 1.x Help
    Replies: 2
    Last Post: Aug 19, 2009, 12:46 PM
  5. CommandColumn
    By Rod in forum Feature Requests
    Replies: 7
    Last Post: Oct 27, 2008, 3:17 PM

Tags for this Thread

Posting Permissions