Antonio
Antonio

Reputation: 47

Hiding Vaadin Grid Headers

I am using a com.vaadin.flow.component.grid.Grid in my Vaadin 14 sample app. I have added an extra header row and introduced a toggle button for changing its visibility.

Unfortunately, this led me deep down to com.vaadin.flow.component.grid.ColumnLayer, which is not visible.

I have also considered dropping the header cell contents and re-adding them. However, this just leaves a full-height row behind. I have also thought about applying some CSS, but could not find a way to, without altering the official source code.

Can anyone help with a more appropriate solution than building my own Grid version (by forking the official implementation)? This feels like pretty common grid functionality to me...

Upvotes: 2

Views: 1123

Answers (1)

Antonio
Antonio

Reputation: 47

To whom might be interested about this... I have used the dirty workaround mentioned the link shared by Tatu Lund. However, that only works for GridSingleSelectionModel. For GridMultiSelectionModel, the underlying implementation is rather strange. For example, I complemented the GridSingleSelectionModel workaround with setting visibility to false on the Un/Select All checkbox the GridMultiSelectionModel generates. This seems to have a listener on it and automatically hides the checkboxes generated by the GridMultiSelectionModel on each row. Which is similar to GridNoneSelectionModel, so unusable if you need to be able to select items.

Unfortunately, I have trusted that Vaadin 14 should be pretty mature by now, but as I explore it I find myself in the position to rather choose version 8, for instance. It's not the first issue of this kind and, that being said, I am not sure I understand why is Vaadin releasing new major versions every so often, while they don't seem to be able to deliver a comprehensive, stable and reliable option to their adopters. Vaadin 8 is almost 5 years old, and it looks like no later version is even close to it.

Upvotes: 0

Related Questions