我希望我的表列之一具有deleteButton。
ActionCell<Entrata> deleteCell = new ActionCell<Entrata>("x",new Delegate<Entrata>() {
@Override
public void execute(Entrata object) {
// rpc stuff....
}
});
好的,但是这一行会产生错误:
Column<Entrata,Entrata> deleteColumn = new Column<Entrata, Entrata>(deleteCell);
“无法实例化列类型”
你怎么看?
最佳答案
在这里,您可以使用工作代码:
假设:
TYPE-在单元格表的行中显示的数据类是否相同,因为我假设您要在删除数据时引用数据实例
public class DeleteColumn extends Column<TYPE, TYPE>
{
public DeleteColumn()
{
super(new ActionCell<TYPE>("Delete", new ActionCell.Delegate<TYPE>() {
@Override
public void execute(TYPE record)
{
/**
*Here you go. You got a reference to an object in a row that delete was clicked. Put your "delete" code here
*/
}
}));
}
@Override
public TYPE getValue(TYPE object)
{
return object;
}
};