Ids must exist in the Container or as a generated column, missing id:

Hi,

i show my Location class in table via BeanContainer. Location entity has 2 properties; id and name. For the purpose of hiding id field, when i call table.setVisibleColumns("name) method it throws “java.lang.IllegalArgumentException: Ids must exist in the Container or as a generated column, missing id: name” exception.

Any idea about this? or a best practice please

NOTE: I use Vaadin 7.1.0

Hi,

it would help if you shared a bit of your code. One thing I can think of is that you should call setVisibleColumns only after you’ve called setContainerDataSource.

Thanks Teppo Kuki; it worked. Are there something “setHiddenColumns()” ?

Ok, good that you got it working. There’s no setHiddenColumns or anything like that, you just have to use the setVisibleColumns. Of course another option is to use setColumnCollapsed which allows the user to set the column visible if he wants to.