Vaadin Grid numbering of fields

Oleksii Tulei :

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("#").

Tatu Lund :

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=146565&siteId=1