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

Made filters a function + added filter usage in example html #1

Closed christophedemey closed 5 years ago

christophedemey commented 5 years ago

I was unable to use the filter property in my project, so i made it a function and also added an example search input on the mainpage.

christophedemey commented 5 years ago

Did u see my pull request ?

relair commented 5 years ago

I did, I don't know why you had trouble with using a property, it was working fine for me. I can't really change it like that as it would be a breaking change. Demo with dynamic table has filters included, so you can see it there: https://stackblitz.com/edit/dynamic-table-odata

christophedemey commented 5 years ago

Hi @relair The problem was that the property was there in intelisense, like the typescript provided it, but at runtime is was always null, so i was unable to set it.

In the url you gave me i can see text and date filter implementations, but i dont see where you are assigning them to the datasource, can you show me please.

Thanks.

relair commented 5 years ago

The property didn't have a getter before, only a setter, so maybe that was causing confusion. I will add getter in the next version. The filters are set by the dynamic table library (which works well with that data source), you can see the line here: https://github.com/relair/material-dynamic-table/blob/929782c59177204e5f7de92e13bfc02624be9671/projects/material-dynamic-table/src/lib/dynamic-table.component.ts#L93

christophedemey commented 5 years ago

I dont understand, when i viewed the object at runtime in chrome developer tool i could see the ODataSource object did not have any filter property, hence i was unable to set it. I did attempt to set it but that just gave me errors, changing it to a function made it work for me.

relair commented 5 years ago

I have published a version 1.1.1 and filters now have a getter as well as a setter, hopefully it would resolve the issues you were having.