BeanItemContainer displays all fields

The BeanItemContainer can not set the visible fields, so it displays all the fields that the Bean knows about. Is there another container that will use the bean for the row instead of adding each bean to the table in a for loop?

I did see a post where they added the bean items in a List object into the table using setItem, but I don’t want to do that for performance reasons. I like most of what BeanItemContainer does, but would like to also be able to have some way not to display all the fields.

Any thoughts or direction is appreciated.

BeanItemContainer contains all the fields from the bean as properties. Use http://vaadin.com/api/com/vaadin/ui/Table.html#setVisibleColumns(java.lang.Object[])]
to select what you want to show in a table.

You can use the below table methods to tweak your table. Just make sure you have getters for “field1” and “field2” in your bean.

setVisibleColumns(new Object[]{"field1", "field2"});
setColumnHeaders(new String[]{"FriendlyNameOfField1", "FriendlyNameOfField2"});

Thanks for all your help. That worked great. Thanks a bunch.