Oleksii Tulei
Oleksii Tulei

Reputation: 23

Vaadin Grid numbering of the rows

I'm new to the vaadin. And I had a question how to create the numbering of lines in the grid using grid.addColumn(???).setHeader("#").

Upvotes: 2

Views: 155

Answers (1)

Tatu Lund
Tatu Lund

Reputation: 10643

It would be easiest to do with TemplateRenderer this way

grid.addColumn(TemplateRenderer.of("[[index]]")).setHeader("#")

So then you would get index of the row in the column (which will not depend on Bean content, sorting etc.) There is more info about TempateRenderer in Vaadin Documentation

Upvotes: 2

Related Questions