Closed pellmann closed 4 years ago
Hi,
fetchChildren is fetching only one page (50 elements). In the example code you have this:
@Override
public Stream<TestNode> fetchChildren(HierarchicalQuery<TestNode, String> query) {
TestNode parent = query.getParent();
if (parent == null) {
return Stream.of(root);
}
return parent.getChildren().stream();
}
query contains an offset, so the correct fetchChildren
is something like that:
@Override
public Stream<TestNode> fetchChildren(HierarchicalQuery<TestNode, String> query) {
TestNode parent = query.getParent();
if (parent == null) {
return Stream.of(root);
}
return parent.getChildren().subList(query.getOffset(), Integer.min(query.getOffset() + query.getLimit(), parent.getChildren().size() ) ).stream();
}
Unfortunately the demos of the tree grid doesn't contain the offset.
Thank you @jcgueriaud1! That makes a lot of sense and fixes my problems.
I use the code from https://github.com/vaadin/vaadin-grid-flow/issues/1087 and add this to generate many children:
The strange effect is, that the items will be like following (with increments of i for the ellipses):
So after 50 something very strange happens.