简体   繁体   English

GWT CellTable:在CellTable中添加/删除行

[英]GWT CellTable : Add / Delete a row in a CellTable

Is the GWT CellTable designed to only display records and update the existing ones. GWT CellTable是否设计为仅显示记录并更新现有记录。

Can one add and delete a record from a CellTable, any pointers to a stable solution. 可以添加和删除CellTable中的记录,任何指向稳定解决方案的指针。

Thanks 谢谢

You can add and remove data rows by manipulating the model object backing the CellTable display. 您可以通过操作支持CellTable显示的模型对象来添加和删除数据行。

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. 然后,您可以通过model.getList()访问列表,但是如果添加或删除了任何行,则必须调用model.refresh()table.setRowCount(model.getList().size())

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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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