T
TanStack15mo ago
typical-coral

row selection checkboxes as the last column

I wanted to know whether it's possible to get the row selection checkboxes as the last row.
2 Replies
other-emerald
other-emerald15mo ago
add such column at the end of your columnDef array. const columns = [ // other columns...., { id: 'select-col', header: ({ table }) => ( <Checkbox checked={table.getIsAllRowsSelected()} indeterminate={table.getIsSomeRowsSelected()} onChange={table.getToggleAllRowsSelectedHandler()} //or getToggleAllPageRowsSelectedHandler /> ), cell: ({ row }) => ( <Checkbox checked={row.getIsSelected()} disabled={!row.getCanSelect()} onChange={row.getToggleSelectedHandler()} /> ), }, ] reference: https://tanstack.com/table/latest/docs/guide/row-selection
Row Selection Guide | TanStack Table Docs
Examples Want to skip to the implementation? Check out these examples:
foreign-sapphire
foreign-sapphire15mo ago
The simple answer is yes, just define it as the last object in your columns array.

Did you find this page helpful?