relair / odata-data-source

Data source for material table and angular cdk table that can work with OData version 4 API.
MIT License
12 stars 6 forks source link

Looking for filtering #42

Open fabric-dev-copilot opened 1 month ago

fabric-dev-copilot commented 1 month ago

Hello, I'm trying to use filters but I can't get it to work properly. Should I use ODataFilter as an array on datasource.filters? I've tried to create a harassed filter condition but I can't get ODataFilter to work properly. It's an interface. If anyone knows how to use this, I'd love to hear from you :)

relair commented 1 month ago

Hi, I think best is to check the example https://stackblitz.com/edit/dynamic-table-odata?file=src%2Fapp%2Ffilters%2Fdate-filter%2Fdate-filter.model.ts . Essentially you need to define a model class that implements ODataFilter and then you can provide instances of that class as filters array. In the example it's done together with components that can set those filters, but it doesn't have to be done that way.