Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT Celltable only displaying 15 rows

Tags:

java

gwt

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...

like image 296
Dimitar Avatar asked May 25 '11 04:05

Dimitar


2 Answers

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.

like image 144
Jason Terk Avatar answered Sep 23 '22 12:09

Jason Terk


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()));
        }
    });
}
like image 29
Italo Borssatto Avatar answered Sep 23 '22 12:09

Italo Borssatto