1
votes

I'm trying to use SimplePager. But I do not understand why the last page next button is still active. If I click on the button it advances on existing records, instead of disabling the button. My test code is as follows:

     CellList <String> cellList = new CellList <String> (TextCell new ());


     ListDataProvider <String> dataProvider = new ListDataProvider <String> ();
     List <String> dataProvider.getList data = ();
     for (int i = 0; i <30; i + +) {
         data.add ("Item" + i);
     }
     dataProvider.addDataDisplay (cellList);

     SimplePager pager = new SimplePager (SimplePager.TextLocation.CENTER, GWT. <SimplePager.Resources> Created (SimplePager.Resources.class), false, -1, true);

     pager.setDisplay (cellList);
     pager.setPageSize (20);
     pager.setRangeLimited (false);
     / / Add the list to the page and pager.
     VerticalPanel vPanel VerticalPanel = new ();
     vPanel.add (pager);
     vPanel.add (cellList);
     RootPanel.get (). Add (vPanel);

Thanks a lot

1
Why do you set pager.setRangeLimited(false);? - Hauke Ingmar Schmidt
All the pages display fine, except the last. If I have a PageSize of 10 with 15 elements, the last page shows elements 6 through 15. I'd prefer to have only 11 through 15 shown. This is the reason to set pager.setRangeLimited(false); - user1175801
Could you please update the code to the current version? The current code is not even valid Java code. - Hauke Ingmar Schmidt

1 Answers

0
votes

try adding the number of rows that your cell list has:

cellList.setRowCount(dataProvider.size(), true);

In this case you are populating the data from a list, so you know exactly how many rows you will have and that's why the second parameter is set to true. If you are populating the celllist from a async call is it better to set it to false.

I hope it helps!