vaadin网格 - 尝试从服务器中获取比一次允许的更多项目

发布于 2025-01-21 19:39:03 字数 724 浏览 5 评论 0原文

〜1500数据需要从DB获取。代码非常简单

List<Item> itemList = getItemsFromDB();
Grid<Item> grid = new Grid<>();
grid.addColumn(Item::getID).setHeader("Id").setAutoWidth(true);
grid.addColumn(Item::getName).setHeader("Name").setAutoWidth(true);       
grid.setAllRowsVisible(true);
grid.setItems(itemList);

,我收到了此警告,网格中只显示了前1000个数据,其余的只是空行。

2022-04-15 15:46:52.475  WARN 19642 --- [nio-8080-exec-6] c.v.flow.data.provider.DataCommunicator  : Attempted to fetch more items from server than allowed in one go: number of items requested '1583', maximum items allowed '1000'.

我知道我可以使用懒惰的加载,但是没有它可以做到吗?数据的大小总是在1500左右,而我实际上并不那么关心它的慢性。

我正在使用vaadin 14.8.8

~1500 data need to be fetched from DB. The code is pretty simple

List<Item> itemList = getItemsFromDB();
Grid<Item> grid = new Grid<>();
grid.addColumn(Item::getID).setHeader("Id").setAutoWidth(true);
grid.addColumn(Item::getName).setHeader("Name").setAutoWidth(true);       
grid.setAllRowsVisible(true);
grid.setItems(itemList);

And I got this warning, only the first 1000 data are shown in the grid, the rest are just empty rows.

2022-04-15 15:46:52.475  WARN 19642 --- [nio-8080-exec-6] c.v.flow.data.provider.DataCommunicator  : Attempted to fetch more items from server than allowed in one go: number of items requested '1583', maximum items allowed '1000'.

I know I can use lazy loading, but can I do it without it? The size of data will always be around 1500, and I don't actually care that much about how slow it is.

I am using vaadin 14.8.8

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盛夏已如深秋| 2025-01-28 19:39:03

问题来自setallrowsible和在数据提供商中添加了 dos Protection 。目前,如果不创建自己的数据提供商,就不可能覆盖它。

我不确定为什么您需要所有的行可见;这增加了最终用户的负载时间。如果您的唯一原因是将网格全高度具有全高,则可以在网格上调用Setheight,Let Vaadin将回调处理到服务器上,以仅获取客户端上显示的数据量。

The problem comes from setAllRowsVisible and the DoS protection added inside the data provider. It's currently not easily possible to overwrite this without creating your own data provider.

I'm not really sure why you need all the rows visible; this increases the load time for your end user. If your only reason is to have the grid full height, you can just call setHeight on the grid and the let Vaadin handle the callbacks to the server to only fetch the amount of data needed to show on the client.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文