Sunday, September 26, 2010

Re: Simple CellList example 2.1 M3

I certainly know how you feel - I'd love to see some documentation for
2.1 as well. I'm sure the gwt team is diligently working on it as we
speak.

Here's some code that I just wrote, that hopefully will help. I'm
passing my ListDataProvider from my presenter into my view.. I'm still
uncertain if this is the best approach.

Presenter
---------

private void updateTable(List<Listing> result) {
ListDataProvider<Listing> listingDataProvider = new
ListDataProvider<Listing>(result);

getView().renderListingTable(listingDataProvider);
}

View
-----
public void renderListingTable(ListDataProvider<Listing> provider) {
CellTable<Listing> ListingCellTable = new CellTable<Listing>();

ListingPanel.add(ListingCellTable);
ListingCellTable.setTitle("Current Listings");
ListingCellTable.setHeight("300px");

Column<Listing, String> nameColumn =
new Column<Listing, String>(new TextCell()) {
@Override
public String getValue(Listing object) {
return object.getItemName();
}
};

Column<Listing, String> ListingStatusColumn =
new Column<Listing, String>(new TextCell()) {
@Override
public String getValue(Listing object) {
return object.getStatus().toString();
}
};

ListingCellTable.addColumn(nameColumn, "Listing");
ListingCellTable.addColumn(ListingStatusColumn, "Status");

provider.addDataDisplay(ListingCellTable);
}

--
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment