BlazorTable
BlazorTable copied to clipboard
How to do Auto Increment Number in first column?
Dear Sir Please help me how to do auto increment number in first column, mean not selected from ID in database. Thank you
Is there a way to actually do this? As in, have a column with a row number that counts up starting from 1, regardless of filters and sorting?
To answer my own question: yes, it is. This is the code setup that I used at the beginning of the table definition:
<Table Items="results" @ref="resultTable">
@{ rowNumber = resultTable.PageNumber * resultTable.PageSize; }
<Column TableItem="Result" Title="#" Sortable="false" Filterable="false">
<Template>
@(++rowNumber)
</Template>
</Column>
...
...with rowNumber being defined as an int in the page's @code block.
Do note that the numbering does not factor in filtering and/or sorting, but does consider pagination.