Hi Noor,
Heres an example of a Celltable (using a DataProvider): public class TestTable implements EntryPoint { private GreetingServiceAsync gService; private CellTable<MyStat> table; /** * This is the entry point method. */ public void onModuleLoad() { // Create a CellTable. table = new CellTable<MyStat>(); // Create name column. gService = GWT.create(GreetingService.class); TextColumn<MyStat> mIdColumn = new TextColumn<MyStat>() { public String getValue(MyStat stat) { return ""+stat.getId(); } }; // Create address column. Column<MyStat, String> machIdColumn = new Column<MyStat, String>(new EditTextCell()) { @Override public String getValue(MyStat stat) { return stat.getMachineId(); } }; machIdColumn.setFieldUpdater(new FieldUpdater<MyStat, String>() { @Override public void update(int index, MyStat object, String value) { object.setMachineId(value); Window.alert(value); } }); TextColumn<MyStat> msisdnColumn = new TextColumn<MyStat>() { public String getValue(MyStat stat) { return stat.getMsisdn(); } }; Column<MyStat, String> bCol = new Column<MyStat, String>(new ButtonCell()){ @Override public String getValue(MyStat myDto) { return "OK"; } }; bCol.setFieldUpdater(new FieldUpdater<MyStat, String>() { @Override public void update(int index, MyStat object, String value) { Window.alert("testing"); } }); // SelectionCell. final List<String> options = new ArrayList<String>(); options.add("Opt1"); options.add("Opt2"); options.add("Opt3"); options.add("Opt4"); options.add("Opt5"); options.add("Opt6"); options.add("Opt7"); options.add("Opt8"); Column<MyStat, String> colMe = new Column<MyStat, String>(new SelectionCell(options)) { @Override public String getValue(MyStat object) { return options.get(object.getOptId()); } }; colMe.setFieldUpdater(new FieldUpdater<MyStat, String>() { @Override public void update(int index, MyStat object, String value) { int i = 0; for (String category : options) { if (category.equals(value)) { object.setOptId(i); break; } i++; } } }); // Create a data provider. MyDataProvider dataProvider = new MyDataProvider(); // Add the cellList to the dataProvider. dataProvider.addDataDisplay(table); // Add the columns. table.addColumn(mIdColumn, "ID"); table.addColumn(machIdColumn, "MachineId"); table.addColumn(bCol, "Report"); table.addColumn(msisdnColumn, "Msisdn"); table.addColumn(colMe, "Country"); // Set the total row count. This isn't strictly necessary, but it affects // paging calculations, so its good habit to keep the row count up to date. table.setRowCount(100000, false); NoSelectionModel<MyStat> selectionModel = new NoSelectionModel<MyStat>(); table.setSelectionModel(selectionModel); SimplePager pager = new SimplePager(); pager.setDisplay(table); RootPanel.get().add(table); RootPanel.get().add(pager); } class MyDataProvider extends AsyncDataProvider<MyStat> { /** * {...@link #onRangeChanged(HasData)} is called when the table requests a new * range of data. You can push data back to the displays using * {...@link #updateRowData(int, List)}. */ @Override protected void onRangeChanged(HasData<MyStat> display) { // Get the new range. final Range range = display.getVisibleRange(); /* * Query the data asynchronously. If you are using a database, you can * make an RPC call here. We'll use a Timer to simulate a delay. */ final int start = range.getStart(); int length = range.getLength(); System.out.println("Range: " + start + " <" + length + ">"); gService.getStats(start, length, new AsyncCallback<ArrayList<MyStat>>() { @Override public void onSuccess(ArrayList<MyStat> result) { updateRowData(start, result); } @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub } }); } } } On Jan 5, 9:54 pm, Noor <baken...@gmail.com> wrote: > Hi, I am stuck with the gwt cell pager which I want to attach to a > cell table. I am setting like this: > > List <ForumMessage> AllMessages=populated from an rpc; > CellTable cellTable = new CellTable <ForumMessage>(); > simplePager = new SimplePager(); > cellTable.addColumn(ColumnM); > cellTable.setRowData(0,AllMessages); > simplePager.setDisplay(cellTable); > simplePager.setPageSize(3); > > ColumnM has correctly been defined > > But when the cell table is being displayed, the first three rows are > correctly shown but when i press next, no rows are shown and the cell > table is as if loading. Now from that page, if I press back, again the > page is as if loading. > > Now, another problem is that I can continually press next and the > numbers of pages keeps on adding even if there are only 8 rows -- 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-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.