Feature request
It would be nice to change cdkColumnDef to null or undefined programmatically to remove the column from the table
Nothing occurs when you change the mat-header or mat-cell in mat-table.
https://stackblitz.com/edit/material2-hide-columns
This would allow me to write a generalized component for hiding sections of the datatable for certain screen sizes, allowing mobile data-tables to be better
The columns displayed are set on the row def so you always have control over which ones are showing.
Can you show me what you mean? The StackBlitz that I included was the only way I could see of doing this, and it didn't work as I expected.
@crutchcorn your class variable displayColumns is only set when you are initialising the class, and not getting updated when you call test. You could either update your test method to update displayedColumns or you could change it to a get accessor
get displayedColumns() { return this.columns.map(c => c.columnDef); }
I'm incredibly dumb. Thank you @benb7760
That demo has been expired. Can u update it
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
@crutchcorn your class variable
displayColumnsis only set when you are initialising the class, and not getting updated when you call test. You could either update your test method to updatedisplayedColumnsor you could change it to a get accessorget displayedColumns() { return this.columns.map(c => c.columnDef); }