I have created a DataTable in my React project. I am trying to include a serial number column and with my current approach it works as per my requirement for on page load results and pagination. [ 1, 2, 3, 4, 5... ]
The issue is while trying to sort the data based on column (click on column header), it sticks with the old serial number which doesn't look in order. [ 2, 3, 5, 1, 4... ]
The expectation is while sorting by column it should display the serial number in order. [ 1, 2, 3, 4, 5... ]
I have used this approach for displaying serial number.
const columns = [
{
title: "S. No.",
render: function (_data: any, _type: any, _row: any, meta: any) {
return meta.row + meta.settings._iDisplayStart + 1;
},
},
.
.
.
]
If sort using Quantity column, serial number gets disturbed.