获取列表<items>来自 Vaadin 8 Grid [英] Get List<items> from Vaadin 8 Grid
本文介绍了获取列表<items>来自 Vaadin 8 Grid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问题:我有一个 Vaadin 8 Grid,但我找不到提取其中项目的方法.
Problem: I have a Vaadin 8 Grid , and I can't find a way to extract the items inside of it.
说明:从网格开始
Grid<Pojo> myGrid = new Grid<>();
我已经对其进行了配置,因此它可以通过延迟加载来获取数据.
I've configured it so it can take data with lazy loading.
myGrid.setDataProvider(
(sortOrd, offset, limit) -> dao.getAllFiltered(offset, limit, filter),
() -> dao.getCountAllFiltered(filter)
);
此时,我想从网格中提取所有项目(以便将其放入 excel),例如 List
.我也试过通过 myGrid.getDataProvider()
,但没有有用的 getter.
At this point, I want to extraxt all the items from the grid (for putting that into an excel), something like List<Pojo> list = myGrid.getItems();
. I've also tried passing through myGrid.getDataProvider()
, but there are no useful getter into it.
我找不到任何吸气剂,我怎样才能做到这一点?谢谢
I can't find any getter, how can I achieve this? Thanks
推荐答案
你基本试过了吗?
List<Pojo> list = grid.getDataProvider()
.fetch(new Query<>())
.collect(Collectors.toList());
这篇关于获取列表<items>来自 Vaadin 8 Grid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文