Skip to content

Commit

Permalink
Merge pull request #6403 from gucal/issue-6402
Browse files Browse the repository at this point in the history
Fix #6402 - DataTable - onContextMenu does not return row data
  • Loading branch information
gucal authored Apr 16, 2024
2 parents 1a2831b + 34c9bff commit 258af95
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 258af95

Please sign in to comment.