4

Is the GWT CellTable designed to only display records and update the existing ones.

Can one add and delete a record from a CellTable, any pointers to a stable solution.

Thanks

2 Answers 2

6

You can add and remove data rows by manipulating the model object backing the CellTable display.

ListDataProvider<OrderLineWeek> model = new ListDataProvider<OrderLineWeek>();
model.addDataDisplay(myCellTableInstance);

You can then access the list through model.getList(), but you must call model.refresh(), or table.setRowCount(model.getList().size()) if you have added or deleted any rows.

Hope this helps.

1
  • Well, a really nice feature would be to allow the user interaction to proceed beyond the last row and that would trigger an add 'event'. Of course, one could either create an empty row for this purpose, or hook into key events to manipulate the backing data provider. Commented Apr 21, 2013 at 3:21
4
ListDataProvider.getList().remove(index);
DataGrid.redraw(); // to refresh

to add, create object then assign data to this object,

ListDataProvider.getList.Add(object);

DataGrid.redraw();

Not the answer you're looking for? Browse other questions tagged or ask your own question.