refactor: simplify row numbering calculation in DataTable component
This commit is contained in:
parent
adb89b73e7
commit
3832723921
@ -90,11 +90,7 @@ export function DataTable<TData, TValue>({
|
||||
const numberingColumn: ColumnDef<TData, TValue> = {
|
||||
id: "numbering",
|
||||
header: "No.",
|
||||
cell: ({ row, table }) => {
|
||||
const pageIndex = table.getState().pagination.pageIndex;
|
||||
const pageSize = table.getState().pagination.pageSize;
|
||||
return pageIndex * pageSize + row.index + 1;
|
||||
},
|
||||
cell: ({ row }) => row.index + 1,
|
||||
enableHiding: false,
|
||||
};
|
||||
computedColumns.unshift(numberingColumn);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user