[CLOSED] TreeGridColumn renderer.

  1. #1

    [CLOSED] TreeGridColumn renderer.

    Is there any way to add a renderer for a TreeGridColumn?

    Many thanks.
    Last edited by Daniil; Jun 18, 2012 at 3:40 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Unfortunately, no. TreeGrid is an inheritor of TreePanel, not GridPanel. So, it doesn't inherit the GridPanel functionality like Column Renderers.

    The single way to customize TreeGridColumns is setting its XTemplate.

    Please clarify what exactly is the requirement? Maybe, it might be implemented using XTemplate.
  3. #3
    I need to customize a boolean column.
    For each record, if my column's value is true, than I have to show an icon, otherwise if it is false I don't want show anything.

    Many thanks for your time.

    Quote Originally Posted by Daniil View Post
    Hi,

    Unfortunately, no. TreeGrid is an inheritor of TreePanel, not GridPanel. So, it doesn't inherit the GridPanel functionality like Column Renderers.

    The single way to customize TreeGridColumns is setting its XTemplate.

    Please clarify what exactly is the requirement? Maybe, it might be implemented using XTemplate.
  4. #4
    It's possible to implement using XTemplate.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!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>
    
        <style type="text/css">
            .my-icon {
                height: 19px;
                background-image: url("resources/images/test.png");
                background-position: center;
                background-repeat: no-repeat;
            }
        </style>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:TreeGrid runat="server" Height="200">
            <Columns>
                <ext:TreeGridColumn Header="Text" DataIndex="text" Width="100" />
                <ext:TreeGridColumn 
                    Header="Test" 
                    DataIndex="test" 
                    Width="100" 
                    Align="Center">
                    <XTemplate runat="server">
                        <Html>
                            <tpl if="test">
                                <div class="my-icon"></div>
                            </tpl>
                        </Html>
                    </XTemplate>
                </ext:TreeGridColumn>
            </Columns>
            <Root>
                <ext:TreeNode>
                    <Nodes>
                        <ext:TreeNode Text="Node1">
                            <CustomAttributes>
                                <ext:ConfigItem Name="test" Value="true" Mode="Raw" />
                            </CustomAttributes>
                            <Nodes>
                                <ext:TreeNode Text="Node1.1">
                                    <CustomAttributes>
                                        <ext:ConfigItem Name="test" Value="false" Mode="Raw" />
                                    </CustomAttributes>
                                </ext:TreeNode>
                                <ext:TreeNode Text="Node1.2">
                                    <CustomAttributes>
                                        <ext:ConfigItem Name="test" Value="true" Mode="Raw" />
                                    </CustomAttributes>
                                </ext:TreeNode>
                            </Nodes>
                        </ext:TreeNode>
                    </Nodes>
                </ext:TreeNode>
            </Root>
        </ext:TreeGrid>
    </body>
    </html>
  5. #5
    That worked great.
    Thread solved.

    Thank you very much.

Similar Threads

  1. [CLOSED] Treegridcolumn templating
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 09, 2011, 6:58 PM
  2. TreeGrid TreeGridColumn XTemplate
    By pandehua in forum 1.x Help
    Replies: 1
    Last Post: Apr 07, 2011, 1:33 PM
  3. [CLOSED] [1.0] TreeGridColumn Doesnt Fully Expand
    By MP in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 17, 2010, 1:27 PM
  4. [CLOSED] How to use format like "UsMoney" for TreeGridColumn
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 24, 2010, 4:24 PM
  5. [CLOSED] RowNumbererColumn renderer
    By danielg in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Oct 27, 2009, 10:30 AM

Tags for this Thread

Posting Permissions