0

I have implement a angular table with filter, every column has own filter, but How can every filter work together.

eg: I have a table, in which every column has own filter:

just like this: https://stackblitz.com/edit/angular-hbakxo-e4njon?file=app%2Ftable-filtering-example.ts

id and name, If I choose 1,2,3 in this multiple choise selector and tip a h in name column. it should be show the result, which is fit to both of input of filter. How should change the code to approach?

user1938143
  • 1,022
  • 2
  • 22
  • 46

1 Answers1

0

I built @matheo/datasource with this kind of complexity in mind, so I wanted to be able to trigger changes in the DataSource from multiple sources (filter change streams), building a request depending the state of the filters, and getting the corresponding data, with ease.

I've released this lib to do that, so you can register as many input streams as you need, build your request object, fetch the corresponding data with a database service, and post process the result in the DataSource before displaying it in the mat-table.

I've built a demo and explained the concepts here:
https://medium.com/@matheo/reactive-datasource-for-angular-1d869b0155f6

Right now I'm from my phone, but if you're interested I can help you to setup your filters if you provide a complete enough SlackBlitz, so I can insert the library there :)

Happy coding!

Mateo Tibaquira
  • 2,059
  • 22
  • 23