1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    13
    Vote Rating
    0
    chuckie474 is on a distinguished road

      0  

    Default Making a column hideable doesn't work?

    Making a column hideable doesn't work?


    I've got a grid with about 8 columns. I want the leftmost column to not be hideable, but the rest can be hidden/shown as needed by the user. However, I don't think that this works:

    Code:
    columnCfg.setHideable(false);
    Am I using this correctly?

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Vote Rating
    88
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    It seems to work, based on http://www.sencha.com/examples/#Exam...needitablegrid and the code it has:
    Code:
        grid.getColumnModel().getColumn(0).setHideable(false);
    That said, it may be necessary for you to set this before the user first uses one of the context menus.

    Can you be more specific, or offer a runnable sample that shows this not working? What version are you using?

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    13
    Vote Rating
    0
    chuckie474 is on a distinguished road

      0  

    Default


    I set up the grid columns using a list of MyColumnModel because depending on my result set, the number of columns to display is dynamic. However, I always want the first column to display and not be hideable. I am unable to directly copy in the code that I am working with, but in general, it looks a little like this:

    Code:
    ColumnConfig cfg = new ColumnConfig<ResultRowModel, String>(props.subject());
    cfg.setHideable(false);
    cfg.setHeader("Subject");
    cfg.setWidth(200);
    columnConfigList.add(cfg);
    
    for (int i=0; i<myColList.size(); i++) {
      MyColumnModel model = myColList.get(i);
      cfg = new ColumnConfig<ResultRowModel, String>(createValProvider(i));
      cfg.setHideable(true);
      cfg.setHeader(model.getColumnLabel());
      cfg.setHidden(model.isHidden());
      cfg.setWidth(200);
      columnConfigList.add(cfg);
    }
    Then when the grid is rendered, all of the columns are hideable, including the first one.

    We are using GXT 3.0, and working on trying to upgrade to 3.0.2.

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Vote Rating
    88
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    GXT 3.0.1 is the latest public release, and 3.0.4 is the latest support release - if you have a support subscription, you may want to skip past 3.0.2 and 0.3, and go right to 3.0.4.

    That code looks like it should work, just like the code in the example I referenced. However, without seeing it *not* work, there isn't much I can suggest. The only place in GXT where anything sets hideable back to true is part of GroupingView, when un-grouping a column. That may be a bug, but will only happen after some user interaction.

  5. #5
    Sencha User
    Join Date
    Jul 2011
    Posts
    13
    Vote Rating
    0
    chuckie474 is on a distinguished road

      0  

    Default


    It appears to be an issue on when the grid is rendered and when the columns are added to the grid. I have a grid that is built on render, and the setHideable() method works on those columns, but for this particular grid it doesn't.

    This is for a search application where the top panel has fields where a user can select their search criteria, then when they hit a button, it returns the results in a grid in the bottom panel. The bottom panel is empty when loading the page, but then upon execution of the search, it creates the grid and the column config list, and then adds the grid to the panel.

    In any case, I am able to work around the issue by using setFixed() instead which ultimately does what I need - the column I need to make unhideable doesn't appear in the context menu any longer.

Thread Participants: 1