primereacts DataTable row indexing

UI Components for React
Post Reply
omar dweikat
Posts: 4
Joined: 26 Aug 2018, 07:31

29 Dec 2018, 10:55

Is there a way to create a column for "rows" wherein the row column will contain the iteration it is on? 1 for row 1, 2 for row 2 etc.?

omar dweikat
Posts: 4
Joined: 26 Aug 2018, 07:31

12 Jan 2019, 08:45

after further research into this, I found da way, first you will have to give the column you want to apply indexing to a body with an action template "body={this.rowIndexTemplate}", then you need to apply the next code segment as a function in your class:
rowIndexTemplate = (rowData, column) => {
return column.rowIndex + 1 + ""
}
And done, the column you gave the body property to with that same function name will now be indexed according to the row it's in.

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest