SimplePager should be 'deaf', but makes data in table disappear (2.1, data presentation widgets)

21 views
Skip to first unread message

Jaroslav Záruba

unread,
Jun 13, 2010, 7:45:01 AM6/13/10
to Google Web Toolkit
Hi

I made my first attempt to utilize CellTable, AsyncListViewAdapter<T> and SimplePager<T>. And I feel like it is christmass to get something like that right out-of-the box. :)

Thanks to this thread I managed to display data, but my pager behaves badly. In situation when the 'rewind' button should be 'deaf' clicking it makes data disappear and the 'loading' indicator shows up, loading, loading and loading till the end of days.
(Same applies to the 'goto end' button.)

Is there some obvious answer to a rookie mistake?

Hopefully this will be easily readable...
protected class MyAsyncAdapter
  extends AsyncListViewAdapter<DTO> {
  @Override
 
protected void onRangeChanged(ListView<DTO> v) {     // doesn't get called on go2start/go2end :(
   
Range r = v.getRange();     fetchData(r.getStart(), r.getLength());
 
}
} private void addTable() {
 
// table:   CellTable<DTO> table = new CellTable<DTO>(10);   table.addColumn(new Column<DTO, String>(new TextCell()) {       @Override
     
public String getValue(DTO myDto) { return myDto.getName();
     
}     }, "Name");

 
// pager:
 
SimplePager<DTO> pager = new SimplePager<DTO>(table);   table.setPager(pager);

  adapter
= new MyAsyncAdapter();   adapter.addView(table);
 
// does not make any difference:
 
// adapter.updateDataSize(0, false);   // adapter.updateDataSize(10, true);

 
VerticalPanel vPanel = new VerticalPanel();   vPanel.add(table);
  vPanel
.add(pager);
 
RootLayoutPanel.get().add(vPanel); }

// success-handler of my fetching AsyncCallback
@Override
public void onSuccess(List<DTO> data) {   // AsyncCallback<List<DTO>> has start field
  adapter
.updateViewData(start, data.size(), data);   if(data.size() < length)
    adapter
.updateDataSize(start + data.size(), true); }

Regards
  J. Záruba

Paul Stockley

unread,
Jun 13, 2010, 10:22:56 AM6/13/10
to Google Web Toolkit
I am seeing the same problem and have logged a bug.

On Jun 13, 7:45 am, Jaroslav Záruba <jaroslav.zar...@gmail.com> wrote:
> Hi
>
> I made my first attempt to utilize CellTable, *AsyncListViewAdapter*<T> and
> SimplePager<T>. And I feel like it is christmass to get something like that
> right out-of-the box. :)
>
> Thanks to this thread<http://groups.google.com/group/google-web-toolkit/msg/f6dd50e6c66a20eb>I

Paul Stockley

unread,
Jun 13, 2010, 10:25:14 AM6/13/10
to Google Web Toolkit
Sorry, forgot to mention. This only happens when you have less than
one page of data.

Jaroslav Záruba

unread,
Jun 13, 2010, 11:31:44 AM6/13/10
to google-we...@googlegroups.com
Thanks Paul!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Reply all
Reply to author
Forward
0 new messages