3

The Angular Material table tutorial shows a way of filtering data in this document. The tutorial uses MatTableDataSource<DataItem> to demonstrate filtering.

However, I created data table using Angular's schematics command ng generate @angular/material:material-table --name <component-name>, and the data source class provided by it extends DataSource<DataItem>. Can it be filtered using the former method?

0

1 Answer 1

2

The API documentation on the page you linked says MatTableDataSource extends DataSource As MatTableDataSource "adds" the filter method to the interface, a simple DataSource can not be filtered, as it just represents data. You may check out the source code of MatTableDataSource at the official github repo to fully understand what the filtering is about.

Nothing prevents you from creating a MatTableDataSource with your loaded data though

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.