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.

Property filter does not exist on datasource when using table schematic

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
gitneerajcommented, Sep 7, 2018

What’s the fix for this, guys?

2reactions
GCSDCcommented, Oct 16, 2018

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)?

  1. Using custom DataSource class: for server side handling, as mentioned by @amcdnl
  2. Using MatTableDataSource: for client side handling
Read more comments on GitHub >

github_iconTop Results From Across the Web

Property 'filter' does not exist on type 'Query<DocumentData>'
1 Answer 1 Β· The Angular FireStore Query API does not contain the filter option that you're attempting. Β· You'd need to use...
Read more >
Understand tables and records in canvas apps - Power Apps
Reference information about working with tables, columns, and records in canvas apps.
Read more >
mat-table filter example: Search & Filter mat-table in Angular
MatTableDataSource contains a property called filter , If we assign search input value to that filter property, the table rows are automatically filtered....
Read more >
Table | Angular Material
Finally, when providing a DataSource object, the table will use the ... If this property is not set, the data cells will render...
Read more >
Filter Data from Your Views
Note: These filtering options are not available if a Wildcard Match filter ... Filters based on table calculations do not filter out underlying...
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