I’m getting this error java.lang.IllegalStateException: GridLazyDataView only supports 'BackEndDataProvider' or it's subclasses, but was given a 'AbstractDataProvider'. Use either 'getLazyDataView()', 'getListDataView()' or 'getGenericDataView()' according to the used data type.
. The code I’ve is getGrid().setDataProvider(this.dataProvider);
. How to convert this dataProvider to use getLazyDataView ? I’ve a 3rd party library which is using dataProvider every where so I cannot use items and bypass this data provider.
Any help here please ?
Can you please show your code
how do you create this.dataProvider?
super();
ObjectUtils.argumentNotNull(dataProvider, "DataProvider must be not null");
this.dataProvider = dataProvider;
}```
and now how is the dataProvider constructed that is passed to this method?
I’m unable to figure out that. My understanding is, this DataProvider<T, F> dataProvider
accepts both a List
and BackEndDataProvider<T, Void> dataProvider
.
I don’t fully understand it
Can you provide a reproducible example?
Looks I’m solving a problem which need not to be solved
is AbstractDataProvider look for the count always ?
how getLazyDataView()', ‘getListDataView()’ or 'getGenericDataView() are different from the AbstractDataProvider?
A DataProvider describes how the data is fetched from the backend. There are some built-in DataProviders; often you just call setItems and a DataProvider is implicitly created for you. You can create your own DataProvider class in a few ways, e.g. by extending from AbstractDataProvider. DataView, on the other hand, is a generic API that allows you to interact with the data set attached to a component. For example, you can fetch an item with a certain index. The specialized DataViews like ListDataView and LazyDataView give you different methods based on the way the data is fetched (the DataProvider)
@nice-camel What is the 3rd party library you are using? Some OSS? Maybe we could improve it so that it would be as easy as the core components are these days
That will be awesome. This OSS provides you a way to let the grid to do some default filter, default query and query sort and some quick ways to sort by columns. The only disadvantage is. it follows the old V14 way to get the count first and then the items.
This is little confusing. As you see here, the AbstractDataProvider
is already implementing BackEndDataProvider
but the error says GridLazyDataView only supports 'BackEndDataProvider' or it's subclasses, but was given a 'AbstractDataProvider'.
so in the custom DataProvider which one should I use ? This is the custom DataProvider