I’ve implemented a DataProvider by implementing FetchCallback with a filter.
I was planning to access to the filter value object in the fetch method through query.getFilter() to pass that through to the repository to fetch only the records I need.
However now I see that the grid is expecting an implementation of FetchCallback<Foo, Void> and doesn’t accept my implementation of FetchCallback<Foo, MyFilter>
What would be the best approach to pass a filter object through the dataprovider to the repository and still have lazy loading?
I could switch to a ListDataProvider and do in memory filtering, but I’m a bit concerned about the amount of data.
You should simply ignore the filtering API in data binding. It was bit of over-engineered at some point. When changing the filters, simply change/reset the databinding.
Thanks a lot for this example! I’ll give it try tomorrow first thing.
I was indeed somehow expecting that overriding the data provider in setItems was a heavier operation than calling refreshAll with the filter passed through to the data provider and the query.
@quirky-zebra thank you for the reference! I was looking for it because I indeed remembered reading something.
I think it’s because “Filtering in-memory data” has it’s own section, while “Filtering with Lazy Data Binding” is hidden beneath “Lazy data binding using callbacks” that it’s a bit harder to find.