From 179de91fcbb36a406ff0781fd97a980d6e3f8533 Mon Sep 17 00:00:00 2001 From: Felix Beceic Date: Tue, 13 Feb 2024 15:04:46 +0100 Subject: [PATCH] Add checks for clicking selector columns --- libs/data-display/src/DataTable.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/data-display/src/DataTable.tsx b/libs/data-display/src/DataTable.tsx index d775c31..e119ada 100644 --- a/libs/data-display/src/DataTable.tsx +++ b/libs/data-display/src/DataTable.tsx @@ -682,10 +682,15 @@ function DataTable({ )} > {primaryCells.map((cell, cellKey) => { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore const colSpan = cell.column.colSpan; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore const align = cell.column.align; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + const isSelector = cell.column.id === "selector"; return ( ({ )} {...cell.getCellProps()} colSpan={colSpan} - onClick={() => (onClick ? onClick(row.original) : undefined)} - onDoubleClick={() => (onDoubleClick ? onDoubleClick(row.original) : undefined)} + onClick={() => (onClick && !isSelector ? onClick(row.original) : undefined)} + onDoubleClick={() => + onDoubleClick && !isSelector ? onDoubleClick(row.original) : undefined + } > {cell.render("Cell")}