refactor: simplify row numbering calculation in DataTable component

This commit is contained in:
Yoga Pangestu 2026-04-14 22:24:19 +07:00
parent adb89b73e7
commit 3832723921

View File

@ -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);