Hi, first of all I’d like to say I’ve been working with Vaadin for a little while now and I think its a pleasure to use as a web UI platform.
One issue I have found is that table.setVisibleColumns seems not to work as expected:
final Table table = new Table("my table");
table.setContainerDataSource(getTableDataContainer());
table.setVisibleColumns(new Object[] {RESOURCE_ID_COLUMN,
NAME_DESC_COLUMN,
CLASS_COLUMN,
PERCENTAGE_COLUMN});
where getTableDataContainer() is:
private Table getTableDataContainer() {
Table table = new Table();
table.addContainerProperty(RESOURCE_ID_COLUMN, String.class, null);
table.addContainerProperty(NAME_DESC_COLUMN, String.class, null);
table.addContainerProperty(CLASS_COLUMN, Boolean.class, null);
table.addContainerProperty(PERCENTAGE_COLUMN, Double.class, null);
table.addContainerProperty(RESOURCE_OBJECT_COLUMN, Part.class, null);
return table;
}
and on a button click I’m doing:
public void addResourceToTable(Part part, Double percentage) {
resourceTable.addItem(new Object[] { part.getId(),
part.getDescription(),
part.isPartClass(),
percentage,
part }, resourceTable.size() );
}
The column names like NAME_DESC_COLUMN are just strings set elsewhere.
As you can probably see all I’m trying to achieve with setVisibleColumns is to hide the object column where I’m stashing my data object because otherwise it just displays an ugly toString() on the thing.
If I remove the .setVisibleColumns the table works fine but obviously the object column is displayed.