T
TanStack2y ago
relaxed-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
stormy-gold
stormy-gold2y 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:
sensitive-blue
sensitive-blue2y ago
The simple answer is yes, just define it as the last object in your columns array.

Did you find this page helpful?