Aj Otto
Aj Otto

Reputation: 124

Why can't i hide the automated numbering column in my Vaadin-table?

I have scoured the docs and stackoverflow but have not found information regarding this numbering column that seems to be hard-coded into Vaadin-tables. (the first column with 1 and 2 as cell-data in the rows)

... I can't upload an image snipping of how it looks because rep. the column in question looks roughly so:

table {text-align:center; padding:5px;}
th {border-bottom:1px solid black}
<table>
<thead>
<th style="background-color: #f60;"></th><th>ID</th><th>Status</th><th>X</th><th>Y</th><th>Z</th>
</thead>
<tbody><tr><td>1</td><td>2</td><td>1</td><td>x</td><td>y</td><td>z</td></tr>
<tr><td>2</td><td>32</td><td>1</td><td>x</td><td>y</td><td>z</td></tr></tbody>
</table>

the offending column's header is highlighted in #f60/orange.

In the visibility dropdown in the top-right of the table there is an option to hide it but when clicked, the row apears hidden for a split second and then reappears.

-in the visibility dropdown the column does not have a name, there is a clickable tick to toggle visibility and a blank space-

I did 'set the visible columns' but this column is un-hidable from the top-level API it seems.

final String[] COL_HEADERS_ENGLISH = new String[]{"ID","status", "x", "y","z"};
table.setColumnCollapsingAllowed(true);
table.setColumnCollapsed("ID", true);

I think i could hide it from Css? I would prefer to find a different solution.

This column looks nice and everything but.... why is it even there?

Upvotes: 1

Views: 62

Answers (1)

Aj Otto
Aj Otto

Reputation: 124

changed

table.setRowHeaderMode(RowHeaderMode.INDEX);

to

table.setRowHeaderMode(RowHeaderMode.HIDDEN);

... that moment when you look at your code for too long and the obvious is hidden

Upvotes: 2

Related Questions