Vaadin 10 Grid 1-based rowindex - what is the simplest way to achieve?

I would like to display the rowindex in a grid column but starting with 1 not with 0.

* The following built-in template variables can be bound to inside the column templates:
* - `[[index]
]`: Number representing the row index

In the file org\webjars\bowergithub\vaadin\vaadin-grid\5.0.4\vaadin-grid-5.0.4.jar!\META-INF\resources\webjars\vaadin-grid\src\vaadin-grid.html I found the updateItem(row, item) method which sets the cells’s index property to row.index and I can use this in java code like myJavaGrid.addColumn(TemplateRenderer.of("[[index] ]")).setHeader("#")

But how is it possible to show row.index+1 ?
Should I use something like mixin or behaviors?
It seems to me I can not use any javascript function in these polymer templates, see:
[Polymer computed binding]
(https://stackoverflow.com/questions/46143762/polymer-how-to-use-imported-function-in-computed-binding?noredirect=1&lq=1)

Is there any easy way to make an own inherited Grid with index_based_1 added?

try this one, hope it help

final List<Person> persons = service.getAllPersons();
		...
		// TODO create Pagination Grid
		final PaginatedGrid<Person> grid = new PaginatedGrid<>();
		grid.setItems(persons);
	
		grid.addColumn(person -> persons.indexOf(person) + 1).setHeader("#");
		grid.addColumn(Person::getName).setHeader("Name");
		grid.addColumn(Person::getEmail).setHeader("Email");
		....

Hey there, [This]
(https://stackoverflow.com/a/62061436/3441504) is how it can be done. In contrast to the answer above, it also works when the user sorts the grid. Cheers

Kaspar: I don’t think this will work.
A DataProvider can be queried with a subset (offset, limit) of all items. Using that result and calculating the index from it may be wrong.

You’d better cache all sorted items and calculate the index from that list.

I vote for something like this:

https://github.com/vaadin/vaadin-grid/issues/1386

Implementing an own component just for that use case seems to be overkill.

I see what you mean. I did indeed not think of large datasets. Thanks for the find, I’m working on it.

And yes I have seen that issue for a long time and have voted too. But nowhere is described currently how to do a 1-based index without touching the polymer stuff. I know my way of allowing such a column is overkill, but at least it works. Sometimes we have to overlook some inefficiencies as long as we are able to deliver.

Sometimes we have to overlook some inefficiencies as long as we are able to deliver.

Of course. Me too, but my solution differs (sort listener, fetching all, saving index in a map instead of slow indexOf).

I like the idea of Vaadin, being a framework in which 99% of all use cases can be solved instantly without a hassle. And we can of course work around bugs and inefficiencies.

I said overkill because I think the learning curve for such a simple feature is too steep. And the use case is not a real corner case.