Closed mshabarov closed 1 year ago
setDataProvider() is now deprecated (in Grid, Select, RadioButtonGroup, CheckboxGroup, ListBox and ComboBox) com.vaadin.flow.component.checkbox.CheckboxGroup.setDataProvider(DataProvider<T, ?>) com.vaadin.flow.component.combobox.ComboBoxBase.setDataProvider(DataProvider<TItem, String>) com.vaadin.flow.component.grid.Grid.setDataProvider(DataProvider<T, ?>) com.vaadin.flow.component.listbox.ListBoxBase.setDataProvider(DataProvider<ITEM, ?>) com.vaadin.flow.component.radiobutton.RadioButtonGroup.setDataProvider(DataProvider<T, ?>) com.vaadin.flow.component.select.Select.setDataProvider(DataProvider<T, ?>)
com.vaadin.flow.data.renderer.LitRenderer.getEventHandlers() com.vaadin.flow.data.renderer.LitRenderer.render(Element, DataKeyMapper, Element) com.vaadin.flow.data.renderer.LitRenderer.withEventHandler(String, SerializableConsumer) com.vaadin.flow.data.renderer.Renderer.getEventHandlers() com.vaadin.flow.data.renderer.Renderer.getValueProviders() com.vaadin.flow.data.renderer.Renderer.render(Element, DataKeyMapper, Element) com.vaadin.flow.data.renderer.Renderer.setEventHandler(String, SerializableConsumer) com.vaadin.flow.data.renderer.Renderer.setProperty(String, ValueProvider<SOURCE, ?>) com.vaadin.flow.data.renderer.Rendering.getTemplateElement()
com.vaadin.flow.data.renderer.LocalDateRenderer(ValueProvider<SOURCE, LocalDate>, DateTimeFormatter) com.vaadin.flow.data.renderer.LocalDateTimeRenderer(ValueProvider<SOURCE, LocalDateTime>, DateTimeFormatter) com.vaadin.flow.data.renderer.Renderer(String)
Are part of flow-components and will be removed as part of https://github.com/vaadin/flow-components/issues/4536
Docs PR created https://github.com/vaadin/docs/pull/2036
Documentation update: https://github.com/vaadin/docs/pull/2036
Projects to be checked after removing deprecated code:
- V24 upgrade instruction
Please let me know where I can find the equivalency for this
I was told setItems
is the equivalent but I do not see anything directly matches with the deprecated setDataProvider
Also this page https://vaadin.com/docs/latest/upgrading/V23-V24-steps is missing. Getting 404 Not Found error
Fixed the link in the description (to point to https://vaadin.com/docs/latest/upgrading)
- V24 upgrade instruction
Please let me know where I can find the equivalency for this
I was told
setItems
is the equivalent but I do not see anything directly matches with the deprecated setDataProvider
@vaithu thanks for the question. Could you please describe what is your case? Do you use a DataProvider
with a configured filter? I noticed that only for Grid
we preserved setDataProvider
as setItems
cannot take DataProvider<T, F>
if F
is not Void
. Seems like we miss that fact and changed public
to private
for ComboBox
, which can be used with a filterable data provider as well. For other components, I think that setDataProvider
can be replaced by setItems
easily, because they are in memory data providers. So need you case to understand the problem better. Thanks!
I'm working on V14 to V24 migration project. This is a framework https://github.com/holon-platform/holon-vaadin-flow written by someone else and now I'm trying to move them to V24.
The author has this
final DatastoreDataProvider<ITEM, ?> datastoreDataProvider = DatastoreDataProvider.create(datastore, target,
getItemType());
getComponent().setDataProvider(datastoreDataProvider);
and the error I'm getting is
If I change to setItems
, the error is
Note the component referred here ListBoxListDataView
@vaithu thanks for the example. So the component is ListBox
. Your data provider has a generic type for filter (second type, which is a wildcard here): DatastoreDataProvider<ITEM, ?>
. Do you use .setFilter()
method of this data provider anywhere? If no, then you can replace the second type with Void
and then you can use one of the existing setItems
methods. If you do, then my question is what is the type of this data provider - in memory or callback (what is the extended class for it and what does isInMemory()
returns) ?
No. I do not see any setFilter
there. DatastoreDataProvider<ITEM, ?>
is extending vaadin interface DataProvider<T, F>
.
Also there is no isInMemory()
. It is a call back method because I see some other example like
@Override
public <FILTER> FilterableSingleSelectInputBuilder<T, ITEM> dataSource(DataProvider<ITEM, FILTER> dataProvider,
SerializableFunction<String, FILTER> filterConverter) {
getComponent().setDataProvider(dataProvider, filterConverter);
return getConfigurator();
}
Again this setDataProvider(dataProvider, filterConverter)
is also not working.
I have a feeling that despite the DataView
API is there and setItems
methods are recommended methods to bind data items to components, we can’t completely get rid of DataProvider
concept and API (DataView
doesn’t fully overlap the API), thus, bringing back setDataProvider
and getDataProvider
as a public methods can be considered with preserving them@Deprecated
with no removal flag, also saying that setItems
is a recommended method, but setDataProvider
is also an option when custom data provider has a filter and or one need to use data provider API directly, for instance, to add data provider listeners. I'll make a draft pull request to bring this API back.
Thanks. That will help a lot because the previous versions heavily depends on this and there are 3rd party enhancements relies on this DataProvider. Also, just an idea/suggestion that if there is a way to redirect setDataProvider to setItems internally with same features/parameters that would be awesome. User will get same performance advantages with same setDataprovider
This ticket/PR has been released with Vaadin 24.2.0.alpha1 and is also targeting the upcoming stable 24.2.0 version.