Skip to content

Commit

Permalink
Fix #6402 - DataTable - onContextMenu does not return row data
Browse files Browse the repository at this point in the history
  • Loading branch information
gucal committed Apr 16, 2024
1 parent 1a2831b commit 34c9bff
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions components/lib/datatable/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
});
}

Expand Down

0 comments on commit 34c9bff

Please sign in to comment.