[OPEN] [#132] Problem with setting the TrueText and FalseText properties of TreeGridBooleanColumn

  1. #1

    [OPEN] [#132] Problem with setting the TrueText and FalseText properties of TreeGridBooleanColumn

    Hi,

    As you can see in the following code i set both TrueText and FalseText of TreeGridBooleanColumn but there is no effect. Anyone got any ideas on how to solve this problem?

        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:TreeGrid ID="TreeGrid1" runat="server" Title="Core Team Projects" Width="500"
            Height="300">
            <Columns>
                <ext:TreeGridColumn Header="task" Width="230" DataIndex="task" />
                <ext:TreeGridBooleanColumn Header="Active" Width="150" DataIndex="active" TrueText="Verdadeiro" FalseText="Falso" />
            </Columns>
            <Root>
                <ext:TreeNode Text="Tasks">
                    <Nodes>
                        <ext:TreeNode Icon="Folder" Expanded="true">
                            <CustomAttributes>
                                <ext:ConfigItem Name="task" Value="Project: Shopping" Mode="Value" />
                                <ext:ConfigItem Name="active" Value="true" Mode="Value" />
                            </CustomAttributes>
                            <Nodes>
                                <ext:TreeNode Icon="Folder">
                                    <CustomAttributes>
                                        <ext:ConfigItem Name="task" Value="Housewares" Mode="Value" />
                                        <ext:ConfigItem Name="active" Value="false" Mode="Value" />
                                    </CustomAttributes>
                                    <Nodes>
                                        <ext:TreeNode Leaf="true">
                                            <CustomAttributes>
                                                <ext:ConfigItem Name="task" Value="Kitchen supplies" Mode="Value" />
                                                <ext:ConfigItem Name="active" Value="false" Mode="Value" />
                                            </CustomAttributes>
                                        </ext:TreeNode>
                                        <ext:TreeNode Leaf="true">
                                            <CustomAttributes>
                                                <ext:ConfigItem Name="task" Value="Groceries" Mode="Value" />
                                                <ext:ConfigItem Name="active" Value="false" Mode="Value" />
                                            </CustomAttributes>
                                        </ext:TreeNode>
                                        <ext:TreeNode Leaf="true">
                                            <CustomAttributes>
                                                <ext:ConfigItem Name="task" Value="Cleaning supplies" Mode="Value" />
                                                <ext:ConfigItem Name="active" Value="true" Mode="Value" />
                                            </CustomAttributes>
                                        </ext:TreeNode>
                                        <ext:TreeNode Leaf="true">
                                            <CustomAttributes>
                                                <ext:ConfigItem Name="task" Value="Office supplies" Mode="Value" />
                                                <ext:ConfigItem Name="active" Value="false" Mode="Value" />
                                            </CustomAttributes>
                                        </ext:TreeNode>
                                    </Nodes>
                                </ext:TreeNode>
                            </Nodes>
                        </ext:TreeNode>
                    </Nodes>
                </ext:TreeNode>
            </Root>
        </ext:TreeGrid>
    Last edited by Daniil; Jan 23, 2013 at 2:58 PM. Reason: [OPEN] [#132]
  2. #2
    Hi,

    Try to set Mode="Raw" for "active" config items
  3. #3
    Hi Vladimir,

    I get the same problem even if i set the 'Mode' property to 'Raw' :(
  4. #4
    Hi,

    Yes, it is ExtJS bug. I can suggest the following workaround
    <%@ 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 id="Head1" runat="server">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Ext.NET test by Marcin</title>
        
        <ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
        
        <script type="text/javascript">
            Ext.tree.BooleanColumn = Ext.extend(Ext.list.Column, {   
                trueText: 'true',   
                falseText: 'false',    
                undefinedText: '&#160;',
        
                constructor : function(c) {
                    c.tpl = c.tpl || new Ext.XTemplate('{' + c.dataIndex + ':this.format}');
                    
                    var t = c.trueText || this.trueText, f = c.falseText || this.falseText, u = c.undefinedText || this.undefinedText;
                    c.tpl.format = function(v){
                        if(v === undefined){
                            return u;
                        }
                        if(!v || v === 'false'){
                            return f;
                        }
                        return t;
                    };
                    
                    Ext.list.BooleanColumn.superclass.constructor.call(this, c);
                }
            });
    
            Ext.reg('tgbooleancolumn', Ext.tree.BooleanColumn);
        </script>
    
    </head>
    <body>
        <form id="form1" runat="server">
           <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <ext:TreeGrid ID="TreeGrid1" runat="server" Title="Core Team Projects" Width="500"
        Height="300">
        <Columns>
            <ext:TreeGridColumn Header="task" Width="230" DataIndex="task" />
            <ext:TreeGridBooleanColumn Header="Active" Width="150" DataIndex="active" TrueText="Verdadeiro" FalseText="Falso" />
        </Columns>
        <Root>
            <ext:TreeNode Text="Tasks">
                <Nodes>
                    <ext:TreeNode Icon="Folder" Expanded="true">
                        <CustomAttributes>
                            <ext:ConfigItem Name="task" Value="Project: Shopping" Mode="Value" />
                            <ext:ConfigItem Name="active" Value="true" Mode="Raw" />
                        </CustomAttributes>
                        <Nodes>
                            <ext:TreeNode Icon="Folder">
                                <CustomAttributes>
                                    <ext:ConfigItem Name="task" Value="Housewares" Mode="Value" />
                                    <ext:ConfigItem Name="active" Value="false" Mode="Value" />
                                </CustomAttributes>
                                <Nodes>
                                    <ext:TreeNode Leaf="true">
                                        <CustomAttributes>
                                            <ext:ConfigItem Name="task" Value="Kitchen supplies" Mode="Value" />
                                            <ext:ConfigItem Name="active" Value="false" Mode="Value" />
                                        </CustomAttributes>
                                    </ext:TreeNode>
                                    <ext:TreeNode Leaf="true">
                                        <CustomAttributes>
                                            <ext:ConfigItem Name="task" Value="Groceries" Mode="Value" />
                                            <ext:ConfigItem Name="active" Value="false" Mode="Value" />
                                        </CustomAttributes>
                                    </ext:TreeNode>
                                    <ext:TreeNode Leaf="true">
                                        <CustomAttributes>
                                            <ext:ConfigItem Name="task" Value="Cleaning supplies" Mode="Value" />
                                            <ext:ConfigItem Name="active" Value="true" Mode="Value" />
                                        </CustomAttributes>
                                    </ext:TreeNode>
                                    <ext:TreeNode Leaf="true">
                                        <CustomAttributes>
                                            <ext:ConfigItem Name="task" Value="Office supplies" Mode="Value" />
                                            <ext:ConfigItem Name="active" Value="false" Mode="Value" />
                                        </CustomAttributes>
                                    </ext:TreeNode>
                                </Nodes>
                            </ext:TreeNode>
                        </Nodes>
                    </ext:TreeNode>
                </Nodes>
            </ext:TreeNode>
        </Root>
    </ext:TreeGrid>
        </form>
    </body>
    </html>
  5. #5
    thank you Vladimir, you´re THE MASTER
  6. #6

Similar Threads

  1. Replies: 10
    Last Post: May 16, 2014, 4:39 AM
  2. [CLOSED] Problem when setting up PagingToolbar´s HideRefresh
    By RCN in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 05, 2012, 12:54 PM
  3. Problem with Javascript setting value i menutextitem
    By plykkegaard in forum 1.x Help
    Replies: 3
    Last Post: Jan 19, 2011, 7:31 AM
  4. [CLOSED] [1.0] TreeGridBooleanColumn
    By methode in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 28, 2010, 12:57 PM
  5. Replies: 0
    Last Post: May 27, 2009, 9:59 AM

Posting Permissions