Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2048
igGrid Hiding and automatic columns width
posted

Hi,

I've just installed new 2012.2 version, but I still have the same problem I had with last version.

I am using different grid objects and, only with this one, I have this strange behavior:

  1. FIRST CASE:
    GridModel gm = new GridModel();
    gm.ID = "grid_id";
    gm.DataSource = // list as queryable
    gm.AutoGenerateColumns = false;
    gm.PrimaryKey = "Id";
    gm.HtmlAttributes = new Dictionary<string, object>() { { "class", "grid" } };
    gm.Width = "100%";

    gm.Columns.Add(new GridColumn("Id", "Id", "number", ""));
    gm.Columns.Add(new GridColumn("Description", "Description", "string", ""));
    ...
    NOTE THAT ALL THE COLUMNS ARE WITHOUT DEFINED WIDTH
    ...
    GridHiding hiding = new GridHiding();
    gm.Features.Add(hiding);

    IT WORKS FINE...



  2. SECOND CASE:
    GridModel gm = new GridModel();
    gm.ID = "grid_id";
    gm.DataSource = // list as queryable
    gm.AutoGenerateColumns = false;
    gm.PrimaryKey = "Id";
    gm.HtmlAttributes = new Dictionary<string, object>() { { "class", "grid" } };
    gm.Width = "100%";

    gm.Columns.Add(new GridColumn("Id", "Id", "number", ""));
    gm.Columns.Add(new GridColumn("Description", "Description", "string", ""));
    ...
    NOTE THAT ALL THE COLUMNS ARE WITHOUT DEFINED WIDTH
    ...
    GridHiding hiding = new GridHiding();
    ColumnHidingSetting hSetId = new ColumnHidingSetting();
    hSetId.ColumnKey = "Id";
    hSetId.AllowHiding = false;
    hSetId.Hidden = true;
    hiding.ColumnSettings.Add(hSetId);
    ...
    HERE I DEFINE ONLY ID COLUMN OR SOME COLUMNS OR ALL THE COLUMNS HIDING PROPERTIES (BEHAVIOR IS THE SAME)
    ...
    gm.Features.Add(hiding);

    THIS IS THE RESULT:

Do you know which can be the problem? In other grids I left out column width during their definition and it works correctly.

Thanks

Flavio

Parents Reply Children