Removing an item from ListDataProvider

How do I remove an item from ListDataProvider? I’m calling a REST API and the response is stored in a ListDatProvider. Now I want to delete an item from this when the same is deleted from the backend.

I tried dataProvider.refreshAll() method hoping it will call the REST API and fetch the latest data but it is not. Looking I’ve to manually delete this so need your guidance on how to remove an item from ListDataProvider.

That’s not possible. A ListDataProvider is a in-memory list of you have provided. It can’t know that an external data source has changed. You can simply remove the item yourself from the supplied list and called refreshAll or removing the item directly from the data provider itself.

Otherwise a more complex solution based on lazy loading provider could be used, were refreshAll would call your service again.

https://vaadin.com/docs/latest/binding-data/data-provider#assigning-a-list-or-array-of-in-memory-data