Assume each row has the format:
Data | <Delete Button>
Now I am trying to add an empty row at the end. And I would like to not showing the <Delete Button>
at the last row. I added the empty data through data provider. Is there a way to achieve this?
There is a method you can override when you create a column:
Column<MyObject, Number> myColumn = new Column<MyObject, Number>(new NumberCell()) {
@Override
public String getCellStyleNames(Context context, MyObject myObject) {
return context.getIndex() == displayItems.size() - 1 ? "hide" : null;
}
};
context.getIndex()
gives you a row number. You can define a CSS style in your CSS file like "hide" with a rule "opacity: 0" or "display: none", and return this style only for the last row.
My example is NumberCell, but it applies to all cells.