question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[table] Allow columns to be hidden

See original GitHub issue

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

It would be nice to change cdkColumnDef to null or undefined programmatically to remove the column from the table

What is the current behavior?

Nothing occurs when you change the mat-header or mat-cell in mat-table.

What are the steps to reproduce?

https://stackblitz.com/edit/material2-hide-columns

What is the use-case or motivation for changing an existing behavior?

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
crutchcorncommented, Dec 12, 2017

I’m incredibly dumb. Thank you @benb7760

2reactions
benb7760commented, Dec 12, 2017

@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); }

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to hide columns in HTML table? - Stack Overflow
Here is the Jquery script for hide column. $('#hide-col').click(function () { $(".dynmic-hidden-col").hide(); });. This way the table column can be hidden ...
Read more >
Show or hide table columns - HTML DOM
Show or hide table columns · Build the menu · Toggle the menu · Toggle table columns · Don't allow to hide the...
Read more >
Hidden columns - DataTables example
Hidden columns. There are times when you might find it useful to display only a sub-set of the information that was available in...
Read more >
Hide or show rows or columns - Microsoft Support
Right-click the selected columns, and then select Hide. Note: The double line between two columns is an indicator that you've hidden a column....
Read more >
Hiding Columns - material-table/core
Hiding Columns · Hidden from being displayed in table. using the column.hidden prop · Hidden from the Columns Button (per column setting). using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found