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

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

Reply via email to