Vaadin 10 TreeGrid.refreshItem 仅在单击鼠标后刷新

Vaadin 10 TreeGrid.refreshItem refrehes only after mouse click

我在 Vaadin 10 中使用了 TreeGrid。 这是我为 treeGrid 设置数据的方式:

treeGrid.setItems( customers, Dataline::getChildren );

当数据改变时,我调用

treeGrid.getDataProvider().refreshItem( line );

仅当我单击 table 中的不同元素时,才会更新 table。 如果我不单击其他元素,则不会发生任何事情。

更新数据的正确方法是什么?

感谢您的帮助! 索斯腾

更新是如何发生的?它来自后台线程吗?

如果是这样,您应该使用 push Server push configuration 在新数据可用时更新 UI。

因为看起来更新仅在下一次服务器请求时发生(当您执行某些操作时)

至少,您使用的代码看起来不错,否则应该可以正常工作。