Skip to content

feat(mat-table): New option "mat-filter-header" for filterable columns like mat-sort-header #28741

@ngdevc

Description

@ngdevc

Feature Description

It will specify the column which is filterable by dataSource.filter. It could be used mat-filter-header like mat-sort-header in the Template side.

Use Case

For the below case, we need to filter only for the visible columns, not real data.
If we set dataSource.filter = 1234, the first element is shown even though Users only see two columns "name" & "value" and there is no matching values. This makes users too confused.
So if we set up filterable columns, we can prevent this issue.

const displayedColumns = ['name', 'value'];
const dataSource = [
 {id: 1234, name: 'AA', value: 65},
 {id: 12345, name: 'BB', value: 67}
];

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureThis issue represents a new feature or feature request rather than a bug or bug fixneeds triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions