Is is possible to get rowData index on click?
You can access id of rowData by rowData.tableData.id. But this is initial index. It is not index of sorted or filtered data.
@cesoftinfo ,
If rowData.tableData.id is not enogh for you, please reopen issue.
you can use what @mbrn said like this for example: onRowClick={(event, rowData) => console.log(rowData.tableData.id)};
Back to index topic, how to get index of rowdata? I like to show alternate colors for rows, and using 'rowData.tabledata.id % 2' for this. It works fine, but as mbrn already said above, it doesn't work when the table is sorted. How can we solve 'alternate colors to rows'?
Thanks a lot in advance.
Update : No need for help. Little bit of more searching and reading given me solution with in this forum. I did below and it works.
options={{
rowStyle: (rowData, index ) => ({
backgroundColor:
index % 2 === 0 ? "#ebffeb" : "#ffebff",
}),
Most helpful comment
Back to index topic, how to get index of rowdata? I like to show alternate colors for rows, and using 'rowData.tabledata.id % 2' for this. It works fine, but as mbrn already said above, it doesn't work when the table is sorted. How can we solve 'alternate colors to rows'?
Thanks a lot in advance.
Update : No need for help. Little bit of more searching and reading given me solution with in this forum. I did below and it works.
options={{
rowStyle: (rowData, index ) => ({
backgroundColor:
index % 2 === 0 ? "#ebffeb" : "#ffebff",
}),