开发者

Integrating Google App Engine with GWT Celltable for large datasets

I am currently trying to implement a gwt front end for my web application that is built on datastore. I would like to have something like my AsyncServices (gin) get the data from the server and display that data in a Celltable. Since my datasets can be very large I would like that data to be fetched every time the user hits the page forward/button.

private CellTable table = new CellTable(); scheduleTable = new CellTable();

SimplePager.Resources pagerResources = GWT.create(SimplePag开发者_开发技巧er.Resources.class); pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true); pager.setDisplay(table);

provider = new AsyncDataProvider() { @Override protected void onRangeChanged(HasData display) { //TODO: Get and Show the appropriate data from GAE here! } };

provider.addDataDisplay(table);


Yes it is possible. And here it is how I did it.

Implement an Abstract Pager. I had to create a Composite Widget and intialize the Widget in the constructor.

I had used two buttons & a label for paging previous and next and showing the page respectively. And in the clickHandler of the next button, I call a RPC and get the list of data I want to show. Then append the list to the existing list of the dataprovider of the celltable. Then call flush method of the data provider. This will push the changes onto the display that is the cell table. Incase your cell table still does not reflect the data, which it should,just flush the dataprovider again or use the setPageStart & setPageSize for the table and set the newrange.

You have to override the onRangeOrRowCountChanged this is where you display which page you are in and do whatever yo might need your pager to do.

For the previous button just call this.previous() as Abstract pager provides all the functionalities you need. Instead of using this.next() we are using our own function to populate the table. and move to the next page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜