Property filter does not exist on datasource when using table schematic
See original GitHub issueBug, feature request, or proposal:
When generating a table schematic, datasource is extended instead of MatTableDataSource. Because of this, the filter method is not available to set up table filtering.
What is the expected behavior?
Extending MatTableDataSource so that filtering may be applied to the table
What is the current behavior?
Filter function not available because generic datasource was extended in x.datasource.ts
What are the steps to reproduce?
ng new table-project --style scss --routing
code cip
ng add @angular/material
ng generate @angular/material:material-table --name table
Add below function to table.component.ts:
applyFilter(filterValue: string) { filterValue = filterValue.trim(); // Remove whitespace filterValue = filterValue.toLowerCase(); // MatTableDataSource defaults to lowercase matches this.dataSource.filter = filterValue; }
Intellisense indicates that filter function not found on datasource
What is the use-case or motivation for changing an existing behavior?
Need to be able to apply table filtering when using schematics
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
β@angular/animationsβ: β^6.0.3β, β@angular/cdkβ: β^6.2.0β, β@angular/commonβ: β^6.0.3β, β@angular/compilerβ: β^6.0.3β, β@angular/coreβ: β^6.0.3β, β@angular/flex-layoutβ: β^6.0.0-beta.15β, β@angular/formsβ: β^6.0.3β, β@angular/httpβ: β^6.0.3β, β@angular/materialβ: β^6.2.0β, β@angular/platform-browserβ: β^6.0.3β, β@angular/platform-browser-dynamicβ: β^6.0.3β, β@angular/routerβ: β^6.0.3β, βcore-jsβ: β^2.5.4β, βrxjsβ: β^6.0.0β, βzone.jsβ: β^0.8.26β
Is there anything else we should know?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:8 (5 by maintainers)
Top GitHub Comments
Whatβs the fix for this, guys?
Rewriting the entire implementation for the DataSource seems to be completely opposite to the goal of using material components.
Why not providing both schematics with full functionality (including filter)?