问题
How can You refresh a grid, when some new row was added to its datasoruce container or one of its rows has been edited?
I have tried the hacks written about here (http://www.helpsforcoder.com/code/31861375-vaadin-refresh-grid-after-row-modification.html ) and here (deleted link to malicious advertisement) but with no positive result. I add / edit the row in a separate subwindow that 'pop-ups' over the view, where the grid, that should update its contents, is placed.
回答1:
grid.getDataProvider().refreshAll();
回答2:
Grid listens to changed property values. So if you are working on the property level of vaadin everything should be fine. If you extract your bean out of the BeanItemContainer you directly manipulate the values of the bean. That way the property container can not recognize your manipluating action.
So you have to send your grid implementation a message, the properties have changed manually. When your BeanItemContainer still has the hard reference to the changed object, grid.markAsDirty() should work.
来源:https://stackoverflow.com/questions/32275944/how-can-you-refresh-a-vaadin-grid-after-data-change