简体   繁体   中英

GWT CELLTABLE SimplePager : Event handling on first,last,next,prev button present in SimplePager?

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 ie 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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM