Hello!
I have an implementation for AbstractBackEndHierarchicalDataProvider:
public class MyDataProvider extends AbstractBackEndHierarchicalDataProvider<MyEntity, Void> {
@Override
public int getChildCount(HierarchicalQuery<MyEntity, Void> query) {
MyEntity parent = query.getParent();
int count = 0;
if (parent instanceof MyEntityChild) {
return 0;
} else if (parent instanceof MyEntityParent) {
count = getMyEntityChildCount(parent);
} else {
count = getMyEntityParentCount();
}
return count;
}
@Override
protected Stream<MyEntity> fetchChildrenFromBackEnd(HierarchicalQuery<MyEntity, Void> query) {
MyEntity parent = query.getParent();
if (parent instanceof MyEntityChild) {
return Stream.empty();
} else if (parent instanceof MyEntityParent) {
return fetchChildren(parent, query.getOffset(), query.getLimit()).stream();
} else {
return fetchParents(query.getOffset(), query.getLimit()).stream();
}
}
@Override
public boolean hasChildren(MyEntity item) {
return getChildCount(new HierarchicalQuery<>(null, item)) > 0 ? true : false;
}
...
}
Trouble:
While scrolling, the methods getOffset and getLimit() always return the same values:
getOffset() = 0, getLimit() = getChildCount(…)
I always get all the data from the backend
Why getOffset() always returns zero?
Thanks