Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

CellTable and Pager: shows all data instead of limited number of items per page

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All,

This is with GWT 2.4. I'm having an issue getting paging to work for CellTable.

I'm not sure what I'm doing wrong. I thought I was following the examples correctly and adapting them to my code.

I tried using both a set size per page for the CellTable and SimplePager, as well as not giving that value and letting it use the default. No luck.

I have 72 items in a CellTable, and I want it to show 10 per page.

Here is the code:



So far, the table data displays fine, except that it's still showing me all 72 users, no matter what I set for the CellTable size and the 4th parameter in the SimplePager constructor.

I've also tried not setting the CellTable size in the constructor, and using 0 as the 4th parameter in the SimplePager constructor (which is how the Showcase of Features for GWT does it to get 15 per page), to no avail.

What am I doing wrong?
 
Joe Vahabzadeh
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, FINALLY figured it out... after piecing together disjointed information from several sites.

I didn't know (until now) that you just can't use cellTable.setRowData(list) if you want a pager. For a pager to work:
1) Do NOT use cellTable.setRowData(list)
2) Create a DataProvider
3) Add the list of items to the DataProvider via its setList method

and voila! The pager works.

So, for any others who're new to CellTable (as I am), that's what worked for me.
 
Bartender
Posts: 11445
18
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for sharing this tip. This is quite surprising. The example here uses setRowData
I personally haven't used cell table. Will check it out.
 
Joe Vahabzadeh
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
True, that example does use setRowData - my guess is that it's because they aren't attempting to use a pager there, but are instead demonstrating the sorting feature.

In any case, I'm glad I could contribute a solution (even if I was the one looking for the info in the first place)!
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add a statement

celltable.setPageSize(10);

It will surely work..
 
Bras cause cancer. And tiny ads:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!