I currently have a CellTable
which I expanded with a filter/paging/sorting.
I am working on adding more features too.
One things that bugs me though, is when you set the limit for a page to be for example 10. If an object doesn't have 10 rows and only has 5 and you switch between them then the table will jump up and down if positioned in the center.
Is there an elegant way, that when the pageSize is set to 10, then if there are less than 10 rows in a table, empty rows will be added?
The ways I have tried so far effect my filtering/sorting/paging, which I do not want.
EDIT 1:
final AsyncDataProvider<Row> provider = new AsyncDataProvider<Row>() {
@Override
protected void onRangeChanged(HasData<Row> display) {
int start = display.getVisibleRange().getStart();
int end = start + display.getVisibleRange().getLength();
end = end >= rows.getFilterList().size() ? rows.getFilterList().size() : end;
List<Row> sub = rows.getFilterList().subList(start, end);
System.out.println("Checking if extra rows needed: " +
table.getVisibleItems().size());
for(int i = table.getVisibleItems().size(); i<10; i++){
System.out.println("ADDED EMPTY ROW");
sub.add(new Row());
}
updateRowData(start, sub);
}
};