Grid filtering using QueryFilter

In Vaadin14, there is a method to set DataProvider to a grid. I use QueryFilter to filter the data. In Vaadin23, this setDataProvider is deprecated. May I know the equivalent in Vaadin23 ?

This is the best way to go: Binding Items to Components | Data Binding | Vaadin Docs

BTW. Did you check the deprecation message? You can still pass that old DataProvider as well, the method name is just setItems.

Thanks @quintessential-ibex . I see there is a significant difference when Page. What is the magic behind the scenes ? Is this something not looking count always and just go with 0 to 50 and so on ?

I didn’t quite understand what you mean. In Vaadin 14, you always need provide the count when doing lazy data binding (which is heavier for the backend). In version 23, providing count is optional and Grid keeps asking for more items as long as those are provided.

so looking for the count is mandatory in V14 whereas in V23 it is not which made huge performance difference. Am I correct ?

For just two values in a table, comboBox made two calls 1. one for count and 2. to get items in V14

in V23, there is no count call, Only items call

Is there a difference if I use this way ?

 Pageable pageable = PageRequest.of(offset / limit, limit, sort);

IIRC Spring makes count query as well if you return pageable. If you want to optimise that away, return list instead.

sorry for resurrecting this thread. In I see the F in the Query<T, F> is not actually used

Is there any way to make the Grid pass a Filter object in the Query when invoking the DataProvider to fetch/count the data?

or the Filter object is only intended for ComboBox’es?

Hopefully the PR for the docs by Matti helps you

will check thank you

it’s related but it doesn’t answer my question

my question is about the F (Filter) parameter of the Query when using the Grid

and, if it’s not to be used and I need to gather the filters myself, how can I trigger a “refresh”. Do I need to set the data provider again with setItems? or can I call some kind of “refresh” ?

(basically right now I’m doing grid.getGenericDataView().refreshAll() and seems to work)