[CLOSED] Treegrid Command Column

  1. #1

    [CLOSED] Treegrid Command Column

    hi,

    how can I add Command column to treegrid. I want to open new window when the the user click on one of the row.
    Last edited by Daniil; Sep 27, 2010 at 6:54 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Unfortunately, the TreeGrid doesn't support CommandColumn.

    You could use the Click event of TreeNode.
  3. #3

    Treegrid Command Column

    I want use the node cllick to expand children and details.
  4. #4
    Hi,

    Please look at the example.

    Example
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:TreeGrid runat="server" Width="310">
            <Columns>
                <ext:TreeGridColumn Header="task" DataIndex="task" Width="200" />
                <ext:TreeGridColumn Header="Assigned To" DataIndex="user" Width="100" />
            </Columns>
            <Root>
                <ext:TreeNode Text="Tasks">
                    <Nodes>
                        <ext:TreeNode Icon="Folder">
                            <CustomAttributes>
                                <ext:ConfigItem Name="task" Value="Project: Shopping" Mode="Value" />
                                <ext:ConfigItem Name="user" Value="1" Mode="Value" />
                            </CustomAttributes>
                            <Nodes>
                                <ext:TreeNode Icon="Folder">
                                    <CustomAttributes>
                                        <ext:ConfigItem Name="task" Value="Housewares" Mode="Value" />
                                        <ext:ConfigItem Name="user" Value="2" Mode="Value" />
                                    </CustomAttributes>
                                </ext:TreeNode>
                            </Nodes>
                            <Listeners>
                                <Click Handler="this.expand(); #{Window1}.show();"/>
                            </Listeners>
                        </ext:TreeNode>
                    </Nodes>
                </ext:TreeNode>
            </Root>
        </ext:TreeGrid>
        <ext:Window 
            ID="Window1" 
            runat="server" 
            Title="Details" 
            Html="Hello!"
            Hidden="true"/>
        </form>
    </body>
    </html>
  5. #5
    thanks Daniil ,
    It is good but this apply to parent level. how would apply to every node

    thanks
  6. #6
    Hi,

    I would suggest you to use the cascade method of TreeNode in a combination with the on method.

    Please look at the example.

    Example
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:TreeGrid runat="server" Width="310">
            <Columns>
                <ext:TreeGridColumn Header="task" DataIndex="task" Width="200" />
                <ext:TreeGridColumn Header="Assigned To" DataIndex="user" Width="100" />
            </Columns>
            <Root>
                <ext:TreeNode Text="Tasks">
                    <Nodes>
                        <ext:TreeNode Icon="Folder">
                            <CustomAttributes>
                                <ext:ConfigItem Name="task" Value="Project: Shopping" Mode="Value" />
                                <ext:ConfigItem Name="user" Value="1" Mode="Value" />
                            </CustomAttributes>
                            <Nodes>
                                <ext:TreeNode Icon="Folder">
                                    <CustomAttributes>
                                        <ext:ConfigItem Name="task" Value="Housewares" Mode="Value" />
                                        <ext:ConfigItem Name="user" Value="2" Mode="Value" />
                                    </CustomAttributes>
                                    <Nodes>
                                        <ext:TreeNode Icon="Folder">
                                            <CustomAttributes>
                                                <ext:ConfigItem Name="task" Value="Housewares1" Mode="Value" />
                                                <ext:ConfigItem Name="user" Value="3" Mode="Value" />
                                            </CustomAttributes>
                                        </ext:TreeNode>
                                    </Nodes>
                                </ext:TreeNode>
                            </Nodes>
                        </ext:TreeNode>
                    </Nodes>
                </ext:TreeNode>
            </Root>
            <Listeners>
                <AfterRender Handler="  var clickHandler = function() {
                                                                this.expand();
                                                                #{Window1}.body.dom.innerHTML = this.attributes['task'];
                                                                #{Window1}.show();
                                                            };
                                        this.getRootNode().cascade(function(node) { 
                                                                        node.on('click', clickHandler)
                                                                    });" />
            </Listeners>
        </ext:TreeGrid>
        <ext:Window 
            ID="Window1" 
            runat="server" 
            Title="Details" 
            Hidden="true" />
        </form>
    </body>
    </html>

    See also

    http://dev.sencha.com/deploy/dev/doc...member=cascade
  7. #7
    I will need to add the listener to every node. If I load it the tree from Database I will add the listner to each node dynamiclly too
  8. #8
    you must posted your reply while I Was wrting:))
    thanks

Similar Threads

  1. [CLOSED] Command Column
    By RCM in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 16, 2012, 4:43 AM
  2. [CLOSED] TreeGrid with Command
    By legaldiscovery in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 18, 2012, 10:01 AM
  3. [CLOSED] Hide the column option(on click of column header) for treegrid
    By AnulekhaK in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 01, 2012, 11:16 AM
  4. command column messing up grid column
    By wp_joju in forum 1.x Help
    Replies: 2
    Last Post: Dec 08, 2010, 6:40 AM
  5. [CLOSED] Confirmation in command column
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 05, 2010, 4:04 PM

Posting Permissions