I'm having an issue where our cell table is only displaying 15 rows. I have something like the following:
//assume these are initialised correctly in the constructor
private final CellTable<DataModel> dataTable;
private DataModel dataModel;
private void initialize(){
dataTable.setRowData(0, data.getDataList());
dataTable.setRowCount(data.getDataList().size());
}
Now getDataList()
returns a List<Data>
object which has a size of 18, but for some reason it only displays 15.
Is there something I'm missing? Is there some "Gotcha" for celltables that restrict the number of rows it will display?
As a side note, when I sort the list I can see all of the data objects but only 15 at a time...
CellTable
, by default, shows 15 items per page.
Call setVisibleRange
to change the rows that the CellTable
displays. See the Cell Table Developer's Guide for more details.
I always use the code below passing my CellTables
/CellLists
when I don't want pagination. Basically, you have to adjust your setVisibleRange
to the list size. And this method does that automatically when you change the list size.
public static void setupOnePageList(final AbstractHasData<?> cellTable) {
cellTable.addRowCountChangeHandler(new RowCountChangeEvent.Handler() {
@Override
public void onRowCountChange(RowCountChangeEvent event) {
cellTable.setVisibleRange(new Range(0, event.getNewRowCount()));
}
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With