Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDS Data Grid Feature: +onRowDoubleClick event #3718

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/eds-data-grid-react/src/EdsDataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function EdsDataGridInner<T>(
defaultColumn,
onRowContextMenu,
onRowClick,
onRowDoubleClick,
onCellClick,
enableFooter,
enableSortingRemoval,
Expand Down Expand Up @@ -485,6 +486,11 @@ function EdsDataGridInner<T>(
? (event) => onRowClick(row, event)
: undefined
}
onDoubleClick={
onRowDoubleClick
? (event) => onRowDoubleClick(row, event)
: undefined
}
onCellClick={onCellClick}
/>
)
Expand Down
11 changes: 11 additions & 0 deletions packages/eds-data-grid-react/src/EdsDataGridProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,17 @@ type HandlersProps<T> = {
* @returns
*/
onRowClick?: (row: Row<T>, event: MouseEvent<HTMLTableRowElement>) => unknown
/**
* Row double-click handler.
*
* @param row The current row
* @param event The click event
* @returns
*/
onRowDoubleClick?: (
row: Row<T>,
event: MouseEvent<HTMLTableRowElement>,
) => unknown
/**
* Cell click handler.
*
Expand Down
2 changes: 2 additions & 0 deletions packages/eds-data-grid-react/src/components/TableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function TableRow<T>({
row,
onCellClick,
onClick,
onDoubleClick,
onContextMenu,
}: Props<T>) {
const { rowClass, rowStyle } = useTableContext()
Expand All @@ -26,6 +27,7 @@ export function TableRow<T>({
}}
className={`${row.getIsSelected() ? 'selected' : ''} ${rowClass?.(row)}`}
onClick={onClick}
onDoubleClick={onDoubleClick}
onContextMenu={onContextMenu}
>
{row.getVisibleCells().map((cell) => (
Expand Down
Loading