Collapsing and reordering columns

You can allow users to hide or show columns at runtime. All you have to do is to enable column collapsing:

    table.setColumnCollapsingAllowed(true);

That will render a little menu to play with columns' visibility as shown in the next screenshot:

Collapsing and reordering columns

If you want to disable column collapsing for a certain column, you can do something similar to the following code snippet:

    table.setColumnCollapsible("A + B", false);

Tip

You have to call table.setColumnCollapsingAllowed(true); when you want some columns to be noncollapsible. If you don't make this call, the menu showing the columns won't be rendered. You can use the setColumnCollapsed ...

Get Vaadin 7 UI Design By Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.