且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Vaadin 8.5.1-行更新后刷新网格

更新时间:2023-11-30 19:26:46

对于要查看的项目作为相同的项目,(和刷新工作)你需要一个相应实现的 equals() hashCode()方法在对象上。

For a item to be seen as the same item, (and the refresh working) you need a corretly implemented equals() and hashCode() methods on the object.

来自文档


public void refreshItem(T item)

public void refreshItem(T​ item)

从界面复制的说明:DataProvi der

Description copied from interface: DataProvider

刷新给定项目。此方法应用于通知所有
DataProviderListeners项目已更新或替换为
新实例。

Refreshes the given item. This method should be used to inform all DataProviderListeners that an item has been updated or replaced with a new instance.

为此正常工作,该项必须实现

For this to work properly, the item must either implement

应该实现DataProvider。getId(Object)以返回
适当的标识符。

DataProvider.​getId(​Object) should be implemented to return an appropriate identifier.

除此之外,你应该创建一个 ListDataProvider ,将它分配给网格,然后通过先前分配的 ListDataProvider

In addition to this, it's you should create a ListDataProvider, assign it to the grid and then do the updated via the same instance of the previously assigned ListDataProvider