Results 1 to 4 of 4

Thread: How to hide a column of a gridPanel?

  1. #1
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    216
    Answers
    4
    Vote Rating
    1
      0  

    Default How to hide a column of a gridPanel?

    Hello,

    I would like to hide a column from a grid when I select a value in a combo box.

    I don't find anything to do such a thing in the Grid.Panel class.

    I can get my grid component like this :
    Code:
    Ext.getCmp('gridId')
    but I don't know what to do with it as no method is developed to do that.

    Any help will be greatly appreciated.

    Regards,

  2. #2
    Sencha User friend's Avatar
    Join Date
    Apr 2011
    Posts
    895
    Answers
    106
    Vote Rating
    27
      0  

    Default

    This functionality is already built into grids for you. Visit the drop-down menu in the header of any column of the grid and see the 'Columns' menu option.

    If you're dead set on rolling your own solution, you can do things like this:

    Code:
    someGrid.columns[<index>].hide();
    someGrid.columns[<index>].show();

  3. #3
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    216
    Answers
    4
    Vote Rating
    1
      0  

    Default is it possible to retrieve a column by his name or ID?

    I've looked for the Class to use to get these info, but there's something I don't catch.

    Does it exist a method in the grid class that can retrieve the selected value?

    Thanks

  4. #4
    Sencha User sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,335
    Answers
    124
    Vote Rating
    91
      0  

    Default

    Hi marxan,
    You can use the following code to get the selected value:

    Code:
    var selectedRecord = yourGrid.getSelectionModel.getSelected();
    Now you can easily found the value of column you want using :
    selectedRecord.data.columnName
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •