PaulW
PaulW

Reputation: 39

How to create a grid to reconfigure grid columns on the fly

I have a grid with 10 columns, and another with over 60. I want to offer a view of these grids where any column or number of columns can be selected to remain visible. Then submit a request to hide all of the remaining 'UN-selected' grid columns, leaving the selected columns viewable.

End-users need to have a mechanism where they can choose which column(s) to view and the remaining columns will be hidden temporarily from view. I know that I can choose each column from the context menu to hide each column, but if I have a grid with multiple columns it can be quite difficult to select each column to hide. I would like to create a mechanism where users can select which columns they want to 'view' and allow the remaining columns to hide.

I believe that grid reconfigure may be the way to go, but there are no real examples showing how I might select the columns to allow viewable "on-the-fly", and then reconfigure the grid based on the new column model.

Upvotes: 0

Views: 725

Answers (1)

dbrin
dbrin

Reputation: 15673

There are a couple of ways you could approach this:

  1. One way would be to loop through the columns and call hide() method on those you wish to hide.

  2. For a large number of columns it might be better to use reconfigure method. using reconfigure with the first paremeter undefined you get to reuse the store that was originally configured:

    reconfigure( undefined, myColumns )

Upvotes: 1

Related Questions