[CLOSED] Property Locked on Column GridPanel: Error: 'id' is null or not an object

  1. #1

    [CLOSED] Property Locked on Column GridPanel: Error: 'id' is null or not an object

    Hello, I want to lock a column in a gridpanel. I took this example for guide: https://examples2.ext.net/#/GridPane...g_Grid/Simple/
    But when I set the property Locked="true" in a column, I get this error on IE "Error: 'id' is null or not an object" or this on Google Chrome "Uncaught TypeError: Cannot read property 'id' of undefined"

    This is my code on .aspx

    <ext:Column ID="ColBatchID" Header="<br /><br /> Orden de <br /> Proceso <br />"
                                        runat="server" Width="120" DataIndex="BATCH_ID" Locked="true">
                                        <HeaderItems>
                                            <ext:TextField ID="FF_BATCH_ID" runat="server" EnableKeyEvents="true" Icon="Find">
                                                <DirectEvents>
                                                    <KeyUp OnEvent="ApplyFilter" Before="return KeyUpEvent(this, e) && checkDate();">
                                                        <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="#{GridHistoricoSTSFBD_Fecha}" />
                                                    </KeyUp>
                                                </DirectEvents>
                                            </ext:TextField>
                                        </HeaderItems>
                                    </ext:Column>
    The error appears for each row in gridpanel, and the value for the column "locked" is not displayed. Even if I set the property EnableLocking="true" on gridpanel, i have the same error.

    I'm using Ext.NET 2.2

    Thank you.
    Last edited by Daniil; Jul 10, 2013 at 4:04 AM. Reason: [CLOSED]
  2. #2
    Hello!

    I couldn't reproduce your problem with our trunk and the following sample. Can you update from the trunk and retest?

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.GridPanel1.Store.Primary.DataSource = new object[]
                {
                    new object[] { "3m Co", 71.72, 0.02, 0.03, "9/1 12:00am" },
                    new object[] { "Alcoa Inc", 29.01, 0.42, 1.47, "9/1 12:00am" },
                    new object[] { "Altria Group Inc", 83.81, 0.28, 0.34, "9/1 12:00am" },
                    new object[] { "American Express Company", 52.55, 0.01, 0.02, "9/1 12:00am" },
                    new object[] { "American International Group, Inc.", 64.13, 0.31, 0.49, "9/1 12:00am" },
                    new object[] { "AT&T Inc.", 31.61, -0.48, -1.54, "9/1 12:00am" },
                    new object[] { "Boeing Co.", 75.43, 0.53, 0.71, "9/1 12:00am" },
                    new object[] { "Caterpillar Inc.", 67.27, 0.92, 1.39, "9/1 12:00am" },
                    new object[] { "Citigroup, Inc.", 49.37, 0.02, 0.04, "9/1 12:00am" },
                    new object[] { "E.I. du Pont de Nemours and Company", 40.48, 0.51, 1.28, "9/1 12:00am" },
                    new object[] { "Exxon Mobil Corp", 68.1, -0.43, -0.64, "9/1 12:00am" }
                };
    
                this.GridPanel1.Store.Primary.DataBind();
            }
        }
        
        public void ApplyFilter(object sender, DirectEventArgs e)
        {
            return;
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <script>
            var template = '<span style="color:{0};">{1}</span>';
    
            var change = function (value) {
                return Ext.String.format(template, (value > 0) ? "green" : "red", value);
            };
    
            var pctChange = function (value) {
                return Ext.String.format(template, (value > 0) ? "green" : "red", value + "%");
            };
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
    
        <ext:GridPanel 
            ID="GridPanel1"
            runat="server" 
            Title="Locking Grid" 
            Width="600" 
            Height="350">
            <Store>
                <ext:Store runat="server">
                    <Model>
                        <ext:Model runat="server">
                            <Fields>
                                <ext:ModelField Name="company" />
                                <ext:ModelField Name="price" Type="Float" />
                                <ext:ModelField Name="change" Type="Float" />
                                <ext:ModelField Name="pctChange" Type="Float" />
                                <ext:ModelField Name="lastChange" Type="Date" DateFormat="M/d hh:mmtt" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel>
                <Columns>
                    <ext:RowNumbererColumn runat="server" />
                    <ext:Column runat="server" Text="Price" DataIndex="price" Width="125" Lockable="false">
                        <Renderer Format="UsMoney" />
                    </ext:Column>
                    <ext:Column ID="ColBatchID" Header="<br /><br /> Orden de <br /> Proceso <br />"
                        runat="server" Width="120" DataIndex="company" Locked="true">
                        <HeaderItems>
                            <ext:TextField ID="FF_BATCH_ID" runat="server" EnableKeyEvents="true" Icon="Find">
                                <DirectEvents>
                                    <KeyUp OnEvent="ApplyFilter" >
                                        <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="#{GridPanel1}" />
                                    </KeyUp>
                                </DirectEvents>
                            </ext:TextField>
                        </HeaderItems>
                    </ext:Column>
                    <ext:Column runat="server" Text="Change" DataIndex="change" Width="125">
                        <Renderer Fn="change" />
                    </ext:Column>
                    <ext:Column runat="server" Text="% Change" DataIndex="pctChange" Width="125">
                        <Renderer Fn="pctChange" />
                    </ext:Column>
                    <ext:DateColumn runat="server" Text="Last Updated" DataIndex="lastChange" Width="135"/>
                </Columns>
            </ColumnModel>
        </ext:GridPanel>          
    </body>
    </html>
  3. #3
    Dynamic Locking Grid Columns

    I have added grid control in design page and in the gridpanel adding columns dynamically. Also Model fields in store adding dynamically.

    When I set {GridPanelID}.EnableLocking = true; getting below error

    Unhandled exception at line [], column 159956 in http://localhost/extjs/ext-all-js/ext.axd?v=31210

    0x800a138f - Microsoft JScript runtime error: Unable to get value of the property 'id': object is null or undefined

    Please help on this.
  4. #4
    Hi @DeepakRasal,

    Please provide a test case.
    Forum Guidelines For Posting New Topics

Similar Threads

Tags for this Thread

Posting Permissions