gwtsimplepager

Percentage-based fast forward button in GWT SimplePager


I have a working CellTable with SimplePager attached, and have enabled fast forward button due to large number of rows.

The number of rows can vary quite a bit, and it makes more sense to advance forward proportional to total table size - e.g. 10% on each click instead of 100 records.


Solution

  • You have to do it manually. If you fetch all the data at once, you will know the total number of records. If you don't make a query to get the total number of records. Override click method of fast forward button. Based on the total number of records, and the given percentage to skip, calculate the number of records to be fetched and make a query or show it if you already have the data.

    EDIT : Fast forward button is a private member and there is no getter and setter for it. There are 2 options for this. Create your own pager class or copy the pager class and place it in a pacakage "com.google.gwt.user.cellview.client" in your project. And make the fastforward button protected or public. This will override the default class.