Show/Hide subset of table columns

We need tables and tree tables that show some columns all the time, and only give users an option to collapse a subset of the column list.

If we could even just filter columns with all whitespace in their header captions, that would do it. Vaadin displays these as about 3 pixels high in the show/hide list, which doesn’t show the checkmark if there is one. Since the header is blank (non-breaking spaces in our case), users can see something highlighted but not really visible, and hide a generated column containing key data/controls without any visual cue on how to get it back.

I don’t see any way to do this other than explicitly subclassing Table, implementing a
complete source copy of
VScrollTable, and repeating for TreeTable and VTreeTable.

That’s way too much branched code to maintain. The design of VScrollTable in particular is problematic - all those inner classes, when all I want to do is override the logic in the method that generates the list of columns to display in the show/hide context menu.

Anyone had to do something like this? It feels to me like two Trac issues I should file - one for the whitespace-only header labels, one to break out columnCollapsingAllowed into a value per column, rather than one global value for the table.

The design of VScrollTable is indeed problematic - we would like to improve it but it is a lot of work to get right and to make it work properly on all the supported browsers, so I don’t know when we will really get into it.

You should create these two tickets anyway.

As for possible workarounds, you might get around this by overriding Table.setColumnCollapsed() and refusing to collapse certain columns. This is not ideal, though.

Thanks. I’ll work on some detailed Trac issues (I have a personal aversion to vague requirements). In the mean time we’ve gone with the less visually appealing and user friendly approach of requiring column labels even for columns that are self-explanatory, like a column of “edit” links, and allowing users to hide such columns if they chose. We’ll just deal with training/support issues as needed when people complain they can’t edit data they have rights to. If we had infinite time, I’d love to write a sample updated widget, as it looks like a fun bit of work, but my boss says we need to finish our project first :slight_smile: