Skip to content

Commit

Permalink
Support for passing event objects thru to various event handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbrom committed Mar 3, 2017
1 parent 37e7457 commit 5c96dd5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions source/Table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
8 changes: 4 additions & 4 deletions source/Table/defaultRowRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}
}

Expand Down

0 comments on commit 5c96dd5

Please sign in to comment.