GWT Celltable only displays 15 rows

I have a problem when only 15 rows are displayed in our cell table. 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()); } 

getDataList() returns a List<Data> object whose size is 18, but for some reason it only displays 15.

Is there something I am missing? Is there any β€œgotcha” for celltables that limit the number of rows it will display?

As a note, when I sort the list, I can see all the data objects, but only 15 at a time ...

+6
source share
4 answers

CellTable , by default, displays 15 elements per page .

Call setVisibleRange to change the rows displayed by the CellTable . See the Honeywell Developers Guide for more information.

+14
source

I always use the code below, passing my CellTables / CellLists when I don't need pagination. Basically, you need to set setVisibleRange to the size of the list. And this method does this automatically when resizing the list.

 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())); } }); } 
+3
source

You can also create an instance of CellTable with page size as parameter

+2
source

Use it

  dataTable.setPageSize(100); 

or specify the desired page size

+1
source

Source: https://habr.com/ru/post/888976/


All Articles