You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 6, 2021. It is now read-only.
E.g. let's say I have a table showing some entities and I want to select the one that has a specific ID.
For in-memory data providers, that's trivial.
I'm not quite sure what the best practice is for data providers with callback, though, [as I'm] a bit unsure about how to handle wanting to select an item that vaadin may not yet have fetched from the backend.
in order to differentiate between beans, the standard Java machinery of equals() / hashCode() is used, on the IDs returned from items by the DataProvider.getId()
So, if you have a bean, say Person, and you know that equals()/hashCode() only takes advantage of the ID field within that bean, you can in theory select a particular person by creating a new Person, setting the ID and passing it to the select() method.
However, this is quite fragile since it depends on the fact that equals/hashcode implementation never changes.
the best and most resilient method is to fetch the actual bean from the back-end by its ID, then pass that to the select() method.
Related, but not mentioned in the conversation with the support chat yet:
Do I need to consider anything special when selecting multiple items in a grid powered by a data provider with callbacks where the selected items may be spread across multiple backend queries?