Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

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 ?
For example:
grid.setItems(yourList)
yourList.remove(item);
//refresh your grid
grid.getDataProvider().refreshAll();
// 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.
Thanks.
I have the same issua right now and I'm trying to fix this but refreshAll() is not working, any advice please here: