From 34c9bff3574c8ff1c267e5f4d46fd19c5a964fff Mon Sep 17 00:00:00 2001 From: gucal Date: Tue, 16 Apr 2024 15:55:37 +0300 Subject: [PATCH] Fix #6402 - DataTable - onContextMenu does not return row data --- components/lib/datatable/TableBody.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/lib/datatable/TableBody.js b/components/lib/datatable/TableBody.js index 42b3ec2738..1225d46ebe 100644 --- a/components/lib/datatable/TableBody.js +++ b/components/lib/datatable/TableBody.js @@ -565,7 +565,7 @@ export const TableBody = React.memo( const onRowRightClick = (event) => { if (props.onContextMenu || props.onContextMenuSelectionChange) { const hasSelection = ObjectUtils.isNotEmpty(props.selection); - const data = hasSelection ? props.selection : event.data; + const data = event.data; if (hasSelection) { DomHandler.clearSelection(); @@ -574,14 +574,16 @@ export const TableBody = React.memo( if (props.onContextMenuSelectionChange) { props.onContextMenuSelectionChange({ originalEvent: event.originalEvent, - value: data + value: data, + index: event.index }); } if (props.onContextMenu) { props.onContextMenu({ originalEvent: event.originalEvent, - data + data, + index: event.index }); }