Column Generation Help

I have a predloaded table that already contains a number of rows of data. I am trying to add a column to the beginning of this table that will contain a button for each of the table. The key here is that this column of buttons is not actually part of the data, but just part of the table. I believe that the way to do this is to use a generatedColumn.

I have the following table defined:

[code]
private Table table = new Table<>(SpaceSummary.class)
.withProperties(“id”, “name”, “title”, “primaryOwner”, “secondaryOwner”, “phoneNumber”, “status”, “birthDay”)
.withColumnHeaders(“id”, “Space Key”, “Title”, “Primary Owner”, “Secondary Owner”, “Pages”, “Status”, “Creation Date”)
.setSortableProperties(“name”, “email”)
.withFullWidth();

[color=#64635a]

[/color]
[/code]I was trying to add the generated column with the following way:

public class ActionColumnGenerator implements Table.ColumnGenerator { public Component generateCell(Table source, Object itemId, Object columnId) { final Button generatedCell = new Button("Column Test"); return generatedCell; } } And the step below is how I add the generated column to my table, which does not work.

table.addGeneratedColumn("Action", new ActionColumnGenerator()); If anyone can provide any help that would be much appreicated. I apologize if this is an obvious answer, I am new to vaadin! :slight_smile:

  • Sachin Jain

Have you tried to call refreshRowCache after adding the new column? https://vaadin.com/api/com/vaadin/ui/Table.html#refreshRowCache()