CRUD in Vaadin Grid

Hi,

I am using vaadin grid web component in polymer and it gets data from a json. Its displaying data perfectly. But there isn’t much documentation about how to dynamically add or delete a row and items in it. I currently trying to delete rows based on multiple selection. But there is no way to that. I search online but I saw the java version of the vaadin grid have add and remove row methods but not in the vaadin grid web elements. Can anyone please refer me to a page where i can find a CRUD tutorial about it.

Or just share codes for adding, deleting and updating.

Thanks,

Hi!

The documentation has some examples how to modify the data: https://vaadin.com/docs/-/part/elements/vaadin-grid/datasources.html

In short, you first need to modify either the items array or remote data, secondly make sure the size property is set properly to represent the total size of the data available and thirdly call refreshItems() function to tell the grid to update itself whenever data changes.

I’ve made a simple example here on how to remove selected items from the data:


http://plnkr.co/edit/tTomFUYdoqZtoJ3SyJyh?p=preview

Hi Sauli Tähkäpää,

Thank you so much for the example! really usefull.