Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it Possible to show and hide some Slickgrid Columns on button click

I need to show/hide some of the slickgrid columns on the click of a button. Is it possible?

For example , I have a slickgrid having 3 columns. On click of a button I want to show three more columns i.e 4,5,6. On clicking the button again these columns should hide and another div should take its place. So basically toggle 3 of the 6 slickgrid columns. Thanks

like image 658
user2426035 Avatar asked Nov 01 '13 10:11

user2426035


People also ask

How to hide column dynamically?

In the button click event, you can show/hide the columns dynamically by using the showColumns/hideColumns methods of the Grid, respectively. The following is the argument of the show/hide columns method. ColumnName should be the field or the headerText of the column.

How to show and hide column in ag Grid?

Just add " hide: true " in your column definition. Show activity on this post. thank you for giving answer..But.. hide: "true" this is working for hide the column from AG grid but this column appears in Toolpanel...

How to hide a column in angular Grid?

The angularjs grid array is $scope. Change the gridOptions to the name of your grid. Replace "yourFieldName" with whatever field you are wanting to hide. Next, put whatever condition you want to test.


1 Answers

SlickGrid doesn't have a concept of showing or hiding columns. It shows whatever columns you specify in the constructor or in a later call to grid.setColumns(). If you want to hide a column, just remove it from the columns array you call grid.setColumns() again.

You can keep the original columns array with all the columns in a separate variable.

like image 79
Tin Avatar answered Nov 02 '22 04:11

Tin