简体   繁体   中英

GWT CellTable : Add / Delete a row in a CellTable

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

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.

ListDataProvider.getList().remove(index);
DataGrid.redraw(); // to refresh

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

ListDataProvider.getList.Add(object);

DataGrid.redraw();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM