Vaadin8 Grid remove

In Vaadin7 I could remove a row with grid.remove(item), but I don’t find this functinality in Vaadin8.

To remove a item from the grid you have to remove it from the dataprovider.
If it’s listProvider then (for example).
grid.setItems(yourList)
yourList.remove(item);
//refresh your grid
grid.getDataProvider().refreshAll();
// the item should be removed from the grid

For a backendprovider (linked to your database) then remove it from your database then refresh your grid.

Thank you!
Is there no way to get the collection of items from the grid? Do I need to keep my own reference to that?
Also, is there a way to determine if an item is present in the grid? I can’t seem to find any method for that on the grid nor its data provider.

From my point of view, if it’s a lazy dataprovider then you don’t have the entire list so you don’t have a reference.
If it’s a ListProvider, the list is a part of your model so you should keep the list (especially if you want to manage it).

You can also cast (ListProvider) grid.getDataProvider() (I don’t like it :smiley: ).

Hi ,

The method
grid.getDataProvider()
. RefreshAll works very well to refresh the grid, but when I update the browser is no longer refreshing with push. I do not understand why

I have a button that executes grid.getDataProvider().refreshAll(); inside access()

If you can recreate that same behavior in a small test case, I’d recommend filing a bug report at https://github.com/vaadin/framework/issues

-Olli