Skip to content

Property filter does not exist on datasource when using table schematic #11637

@landonwaldner

Description

@landonwaldner

Bug, 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?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions