[CLOSED] Grid State Restore - Hidden Column

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Grid State Restore - Hidden Column


    My grid is correctly keeping the column sort order and filtering states correctly in the cookie which is correctly restored when it is re-opened.

    However, for a column hidden manually (i.e. click on a column's dropdown menu and de-select the column so it doesn't show), the state seems to e correctly stored in the cookie (see below) but it's not restored.

    Cookie (partial):


    Let me know what I should try.

    BTW, I'm using the latest from SVN 1.0 branch.

    Last edited by geoffrey.mcgill; Sep 17, 2010 at 6:43 PM. Reason: please use [CODE] tags, [CLOSED]
  2. #2

    I don't have such issue, here is my test case (hide column and refresh page)
    <%@ 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.Store1.DataSource = this.Data;
        private object[] Data
                return new object[]
                    new object[] { "3m Co", 71.72, 0.02, 0.03, "9/1 12:00am" }
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Simple Array Grid - Ext.NET Examples</title>
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />    
        <ext:ResourcePlaceHolder runat="server" />
        <script type="text/javascript">
            var template = '<span style="color:{0};">{1}</span>';
            var change = function (value) {
                return String.format(template, (value > 0) ? "green" : "red", value);
            var pctChange = function (value) {
                return String.format(template, (value > 0) ? "green" : "red", value + "%");
        <ext:ResourceManager runat="server" StateProvider="Cookie" />
        <h1>Simple Array Grid</h1>
            Title="Array Grid" 
                <ext:Store ID="Store1" runat="server">
                                <ext:RecordField Name="company" />
                                <ext:RecordField Name="price" Type="Float" />
                                <ext:RecordField Name="change" Type="Float" />
                                <ext:RecordField Name="pctChange" Type="Float" />
                                <ext:RecordField Name="lastChange" Type="Date" DateFormat="M/d hh:mmtt" />
            <ColumnModel runat="server">
                    <ext:Column ColumnID="Company" Header="Company" DataIndex="company" />
                    <ext:Column Header="Price" DataIndex="price">                  
                        <Renderer Format="UsMoney" />
                    <ext:Column ColumnID="Change" Header="Change" DataIndex="change">
                        <Renderer Fn="change" />
                    <ext:Column Header="Change" DataIndex="pctChange">
                        <Renderer Fn="pctChange" />
                    <ext:DateColumn Header="Last Updated" DataIndex="lastChange" />
                <ext:RowSelectionModel runat="server" SingleSelect="true" />
    Please provide own test sample
  3. #3

    The example you provided does not work for what I need.

    My problem is not with hiding the column and refreshing the page.

    My test case:
    1. Hide the column
    2. Close the window containing the grid
    3. Launch the window containing the grid
    Expected: To have the column I hid still hidden.

    I have the GridPanel "Stateful" set to true and the "StateID" also set. As I mentioned earlier, keeping the grid's state works for column sorting and filtering but not for hiding.

  4. #4
    BTW, I'm using IE8 and hitting F5 brought the hidden column back on your example.

  5. #5

    For me, F5 works correctly, column is still hidden (don't forget about StateProvider="Cookie")

    Please provide your test sample which demonstrates the issue
  6. #6
    I do have StateProvider="Cookie".

    Like I said, your example behaves that same way as mine on my machine.

    The fact that it works fine on yours makes it obvious there is something I'm not doing/having configured correctly.

    *** Cookie entry after hiding Company column:

    The cookie looks fine where the "Company" column now has the hidden attribute.

    It feels like there is something preventing the JS code which is supposed to apply the hidden value to the column.

    Any pointers as to what could be preventing it?

    Last edited by geoffrey.mcgill; Sep 17, 2010 at 6:42 PM. Reason: please use [CODE] tags
  7. #7
    An interesting fact:

    On your example I tried hiding one by one.

    I did it left to right:
    * Company: is hidden but comes back on F5
    * Price: is hidden and STAYS hidden on F5
    * 1st Change (val = 0.02): is hidden but comes back on F5
    * 2nd Change (val = 0.03%): is hidden and STAYS hidden on F5
    * Last Updated: is hidden and STAYS hidden on F5.

    Do you get the same behavior on you side?

  8. #8
    By inspecting the GridPanel declaration I can see a pattern where the columns that STAY hidden after F5 DO NOT have a "ColumnID" property.

  9. #9
    Looks like that's the culprit (Column->ColumnID property).

    To try it on my grid, I took the ColumnID out of one of my grid's columns and whala!, it worked!

    So now the question is: can I live without the ColumnID property without unwanted side-effects? :-)

  10. #10

    If your columns is not movable (position is fixed between requests) then ColumnID is not required
    Otherwise ColumnID is required (by default, column id equals the index)
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] GridPanel Hidden Column
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Aug 27, 2012, 8:57 AM
  2. Replies: 2
    Last Post: Dec 07, 2011, 5:37 AM
  3. [CLOSED] Make an Ext.Column truly hidden
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 10, 2011, 10:53 PM
  4. [CLOSED] Restore State?
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 20, 2010, 2:58 PM
  5. [CLOSED] GridPanel Column Size Restore from Cookie
    By ecerrillos in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Oct 29, 2010, 8:05 PM

Posting Permissions