Please go through link https://stackblitz.com/edit/angular-primeng-table-order-resize-toggle?file=src%2Fapp%2Fapp.component.html As per the link I need to do for Angular Mat table selecting and deselecting columns.
Asked
Active
Viewed 5,636 times
-1
-
what is your issue? – Hien Nguyen Apr 11 '19 at 07:41
-
Just create two arrays - one with all available columns, and one that will contain the columns you currently want to see. Use latter one with your mat-table, and create a function for adding/removing options from the first array to the second one. The Material Table will then hide/show the columns based on the content of the latter array. – Lars Rødal Apr 11 '19 at 07:43
-
Thanks for the response. as per the link in options am having column list based on column selection the table will update if columns are more user can customize the table. – Chiran Apr 11 '19 at 07:44
-
@LarsRødal is there any possible to make one example in stackblitz. – Chiran Apr 11 '19 at 07:45
1 Answers
0
Here is a simple proof of concept: https://stackblitz.com/edit/poc-column-selector The table is hidden if no columns are selected, if you select one or more column they are displayed using the full width (flex).
The displayed order of the columns is decided by their order in the string-array with column definitions, not by the order of the markup in the html file.

Lars Rødal
- 809
- 1
- 9
- 26