The sample example for DataTable should include ways to use both sorting and filter feature, or documentation on how to add more than one feature in md-table. The implementation of this process is not very straightforward.
For the case of sorting + filter, what do you find makes it difficult to combine them?
The issue I am facing is when I am triggering changes, I am only getting results for one feature.
All that really matters is that in connect(), you must make sure that your return Observable is correctly mapping trigger events to the right results.
_exampleDatabase.data_exampleDatabase.dataSo really all you need to do is take your data, sort it, and filter it (or filter and then sort).
return Observable.merge(...displayDataChanges).map(() => {
return this.getSortedData()
.filter((item: UserData) => {
let searchStr = (item.name + item.color).toLowerCase();
return searchStr.indexOf(this.filter.toLowerCase()) != -1;
});
});
Here's an example of a table that includes pagination, sorting, filtering, and selection.
https://plnkr.co/edit/EU3BBlViWpPf2NJW4PXx?p=preview
The code is actually already in the repo as table-overview-example but we have yet to include it into the docs site due to some theming issues. Will leave this issue up until we do so.
@andrewseguin and @willshowell Thank you. This really helped!
@andrewseguin thank you for the plunker link. That helped! Can you please provide an example with server side pagination. I am actually stuck in implementing this with http call
@uday4vunnam See https://github.com/angular/material2/pull/5766!
@willshowell Wow! thank you so much
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Here's an example of a table that includes pagination, sorting, filtering, and selection.
https://plnkr.co/edit/EU3BBlViWpPf2NJW4PXx?p=preview
The code is actually already in the repo as
table-overview-examplebut we have yet to include it into the docs site due to some theming issues. Will leave this issue up until we do so.