Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Vaadin 8: how to add/remove data to/from Grid/ComboBox
What is the correct way to dynamically add and remove data to/from a Vaadin 8 Grid or ComboBox?
There seem to be no add or remove functions in Grid and ComboBox. This ist by design, I think.
But the DataProviders also do not offer such a functions.
If I use a ListDataProvider I have to create a new DataProvider every time I want to change the data list.
Event worse: I can not get the current list from the ListDataProvider so I have to store the list twice. Edit: ListDataProvider.getItems().
Why does the ListDataProvider not support changing the data list?
What is the recommended way to display and change list data dynamically in an UI?
Alexander Ley: Why does the ListDataProvider not support changing the data list?
I didn't test it but did you try to add/remove the item from the list ?
//refresh your grid
// the item should be removed from the grid
That was too easy ;)
I do have a special DataProvider to support filtering, but changing the ListDataProvider.backend list (getItems.add(..)) and calling refreshAll() did the trick.