1

I tried making a callbackdataprovider with vaadin flow for my grid. But it returns an incompatible types error when i tried making it.

I've already minimized the code to the simplest problem version of the problem and it still doesnt work, and i followed the vaading flow guide for making one, and its pretty much the same as my code :

dataProvider = DataProvider.fromCallbacks(
            query -> {  
                List<Person> people = new ArrayList<>();                
                return people;              
            },          
            query -> {          
                int i = 0;              
                return i;               
            });

this should work, but instead i get the following error :

incompatible types: no instance(s) of type variable(s) T,F exist so that com.vaadin.data.provider.CallbackDataProvider conforms to com.vaadin.flow.data.provider.CallbackDataProvider

JJIqbal
  • 630
  • 1
  • 8
  • 23

1 Answers1

0

All Vaadin 10+ (Flow) related classes are in the com.vaadin.flow package. Please use DataProvider from that package. Here is a code example:

import com.vaadin.flow.data.provider.*;

DataProvider<Person, Void> dataProvider = DataProvider.fromCallbacks(
            // First callback fetches items based on a query
            query -> {
                ...
                return persons.stream();
            },
            // Second callback fetches the number of items for a query
            query -> getPersonService().getPersonCount());
Steffen Harbich
  • 2,639
  • 2
  • 37
  • 71