Files
twenty_crm/front/src/modules/ui/tables/utils/getCheckBoxColumn.tsx
Lucas Bordeau 05d22c1b06 Lucas/t 295 fix checkbox column width (#261)
* wip

* Fixed table and column width

* Use last resizable column instead of table width 100%

* Removed comments

* Fix lint

* Fixed table theme

* Removed left clickable margin

* Removed overflow

* Added table width
2023-06-12 10:47:35 +00:00

28 lines
866 B
TypeScript

import { CellContext } from '@tanstack/react-table';
import { CheckboxCell } from '@/ui/components/table/CheckboxCell';
import { SelectAllCheckbox } from '@/ui/components/table/SelectAllCheckbox';
export function getCheckBoxColumn() {
return {
id: 'select',
header: ({ table }: any) => (
<SelectAllCheckbox
checked={table.getIsAllRowsSelected()}
indeterminate={table.getIsSomeRowsSelected()}
onChange={(newValue) => table.toggleAllRowsSelected(newValue)}
/>
),
cell: (props: CellContext<any, string>) => (
<CheckboxCell
id={`checkbox-selected-${props.row.original.id}`}
name={`checkbox-selected-${props.row.original.id}`}
checked={props.row.getIsSelected()}
onChange={(newValue) => props.row.toggleSelected(newValue)}
/>
),
size: 32,
maxSize: 32,
};
}