From 5c96dd5eed04550da19c276b57f711219260777d Mon Sep 17 00:00:00 2001 From: Paul Broman Date: Fri, 3 Mar 2017 16:02:48 -0500 Subject: [PATCH] Support for passing event objects thru to various event handlers --- source/Table/Table.js | 6 +++--- source/Table/defaultRowRenderer.js | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/Table/Table.js b/source/Table/Table.js index 551940d60..37b302dd6 100644 --- a/source/Table/Table.js +++ b/source/Table/Table.js @@ -403,17 +403,17 @@ export default class Table extends PureComponent { ? SortDirection.ASC : SortDirection.DESC - const onClick = () => { + const onClick = (evt) => { sortEnabled && sort({ sortBy: dataKey, sortDirection: newSortDirection }) - onHeaderClick && onHeaderClick({ columnData, dataKey }) + onHeaderClick && onHeaderClick({ evt, columnData, dataKey }) } const onKeyDown = (event) => { if (event.key === 'Enter' || event.key === ' ') { - onClick() + onClick(event) } } diff --git a/source/Table/defaultRowRenderer.js b/source/Table/defaultRowRenderer.js index f3e245f99..472c970d6 100644 --- a/source/Table/defaultRowRenderer.js +++ b/source/Table/defaultRowRenderer.js @@ -31,16 +31,16 @@ export default function defaultRowRenderer ({ a11yProps.tabIndex = 0 if (onRowClick) { - a11yProps.onClick = () => onRowClick({ index, rowData }) + a11yProps.onClick = (evt) => onRowClick({ evt, index, rowData }) } if (onRowDoubleClick) { - a11yProps.onDoubleClick = () => onRowDoubleClick({ index, rowData }) + a11yProps.onDoubleClick = (evt) => onRowDoubleClick({ evt, index, rowData }) } if (onRowMouseOut) { - a11yProps.onMouseOut = () => onRowMouseOut({ index, rowData }) + a11yProps.onMouseOut = (evt) => onRowMouseOut({ evt, index, rowData }) } if (onRowMouseOver) { - a11yProps.onMouseOver = () => onRowMouseOver({ index, rowData }) + a11yProps.onMouseOver = (evt) => onRowMouseOver({ evt, index, rowData }) } }