4

How to handle event on SimplePager? Event handling on first,last,next,prev button present in SimplePager? I am using CellTable gwt 2.3.0

Right now I am parsing xml in which 100 records are present. xml coming from server.

@ time I am showing 100 reocrd per table_page i.e pageSize(100);

Whenever I will click next button then I will made server request for getting next 1OO records same way for every button..

How to Handle event on SimplePager ?

Any help or guidance in this matter would be appreciated

StackOverFlow
  • 4,486
  • 12
  • 52
  • 87

1 Answers1

4

in fact, you don't need to handle event on pager, this is your data provider which takes care of loading.

Read the javadoc on simple pager : http://google-web-toolkit.googlecode.com/svn/javadoc/2.3/com/google/gwt/user/cellview/client/SimplePager.html

the simple pager add buttons and call the data provider. It gives to the data provider all informations you need to load good records (offset, size...)

EDIT: create a new subclass of AbstractDataProvider (javadoc) which implements the method onRangeChanged. In that method you get a HasData object which contains all information you need to call an rpc service (offset of visible items).

When you have received response of your service, call the updateRowCount and updateRowData method. This will update the display and the pager.

You don't need to register handler for pager buttons, only defines DataProvider and all will run like a charm.

Jerome Cance
  • 8,103
  • 12
  • 53
  • 106
  • Thanks for reply. I want to make server call on buttons(onclickHandler) present in SimplerPager widget – StackOverFlow Aug 05 '11 at 11:40
  • Jerome C. How to check/identify "user clicks on last button" in onRangeChanged method of AsyncDataProvider with the help of HasData display – StackOverFlow Mar 01 '13 at 06:41