Reconfiguring number of Vaadin 7 Grid Columns

Hi,

How do I configure Vaadin 7 Columns in Grid Component?

For example, if I want to add a checkbox to display only specific number of columns, let us say I have twenty columns and I want to display only 3 columns…how can I do that in Vaadin 7

Any ideas would be really helpful …

Each Column in Grid has a setHidden method you can use to show or hide a column. You can get the columns from Grid with getColumn(Object propertyId).

-Olli

Thanks for the response. However, I don’t get it…

setHidden method only hides all those columns but is there generic way to make it more configurable …so let’s say I want to show only 3 columns out of twenty and not hide all other columns then how do I do that

You can for example use setColumns(Object... propertyIds) to set the defined columns, too. Then the missing columns from that list won’t be hidden, the will be removed - not necessarily a huge difference from the end user point of view.

Olli Tietäväinen:
You can for example use setColumns(Object... propertyIds) to set the defined columns, too. Then the missing columns from that list won’t be hidden, the will be removed - not necessarily a huge difference from the end user point of view.

Thanks for the response…but I see the same discussion here:
https://github.com/vaadin/framework/issues/6471

Not sure how one can make this more configurable columns still, code snippet would be handy

I think those options are pretty much it, but you can always go to [vaadin.com/api]
(https://vaadin.com/api/) if you want to double-check yourself.

-Olli