How can You refresh a vaadin grid after data change

好久不见. 提交于 2019-12-11 08:35:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!