GridLazyDataView with filter

I’m wondering how to lazy load items for Vaadin 23 Grid with a filter ?
The ComboxBox has a method setItemsWithFilterConverter but such method is missing on Grid or GridPro !
I want to configure a grid for using with filters, but want to prevent using the deprecated DataProvider. In Vaadin 14 I use

(1) DataProvider<MyDto, JooqFilter<MyRecord>> dataProvider = DataProvider.fromFilteringCallbacks(
query -> {
     JooqFilter<MyRecord> filters = query.getFilter().orElse(null); // this didn't work in Vaadin 23
     List<MyDto> positions = projectListService.fetchForGrid(query.getOffset(), query.getLimit(), query.getSortOrders(), filters);
     return positions.stream();
 }, query -> {
            JooqFilter<MyRecord> filters = query.getFilter().orElse(null);
            return projectListService.countForGrid(filters);
});
(2) grid.setDataProvider(dataProvider.withConfigurableFilter((Object query, JooqFilter<MyRecord> filter) -> filter);

The error is cannot convert from Void to JooqFilter<MyRecord> due to the fact that I can’t create any Grid/ DataView or whatever with a Java Generics type parameter for the filter as as I use in Vaadin 14 shown in (2) with the help of withConfigurableFilter which I miss in Vaadin 23.
is only my abstraction for filter data by SQL where conditions created with JOOQ and should be out of scope for the actual problem.

:wave:

but want to prevent using the deprecated DataProvider.

Are you sure it’s deprecated? I thought only #setDataProvider is deprecated but you can still use e.g. https://vaadin.com/api/platform/23.1.7/com/vaadin/flow/component/grid/Grid.html#setItems(com.vaadin.flow.data.provider.BackEndDataProvider)

But those methods also using Void as filter type …

public GridLazyDataView<T> setItems​(BackEndDataProvider<T,​Void> dataProvider)

You’re right, but we could still do any filtering in the data provider? We just need to pass the filter from outside as there is no filter in the query directly… :thinking:

The data provider is not deprecated. Only the setDataProvider is replaced by setItems and has been deprecated.

@adaptable-uakari Thank you for the link … have had a short look … your view looks pretty much the same as my view excerpt my jooq queries are far too big for inlining within the fetch callback :grinning: But I saw the solution for my problem … a few small changes, mainly avoid var where dedicated variable type declaration were necessary, the distinction between the intermediate CallbackDataProvider and the final ConfigurableFilterDataProvider and then setItems(dataProvider) … small but important changes… Now it works ! Thank you.