Question

Here I have itemDetailTable

CellTable<List<String>> itemDetailTable = new CellTable<List<String>>();
ListDataProvider<List<String>> dataProvider = new ListDataProvider<List<String>>();
dataProvider.addDataDisplay(itemDetailTable);
final ScrollPanel itemDetailScrollPanel=new ScrollPanel();
FlowPanel itemDetailFlowPanel=new FlowPanel();
itemDetailFlowPanel.add(itemDetailTable);
itemDetailScrollPanel.add(itemDetailFlowPanel);

Now my List<List<String>> has 16 rows, however, after ran it showed the table with 15 rows only. If I want to see the row 16 then need to click on the last cell of the table (the cell in the bottom right handside of the table) & enter arrow-down key then it will show the record 16.

If i use Simplepager

SimplePager itemDetailPager = new SimplePager(); itemDetailPager.setDisplay(itemDetailTable);

then it will have 2 page, the 1st page has 15 records and the 2nd page has 1 record.

That is not OK as I want the table to show all the records at once and won't hide any records.

Someone said that maybe cos I use List<String> & that is causing the problem, but I am not sure if that is the main cause.

But If I only has 14 records, then it showed all 14 records without any problem.

SO How to fix it?

Était-ce utile?

La solution

Try any one

Just pass page size while constructing CellTable that constructs a table with the given page size.

int pageSize=16;
CellTable<List<String>> itemDetailTable = new CellTable<List<String>>(pageSize);

use CellTable#setPageSize() to set the number of rows per page and refresh the view.

CellTable<List<String>> itemDetailTable = new CellTable<List<String>>();
itemDetailTable.setPageSize(16);

Note: use GWT.create() to construct the SimplePager.Resources object with as shown below:

SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
// pass the parameters as per your requirement
SimplePager pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top