The problem with using e.stopPropogation
with the ignoreRowClick
feature is it prevents any click events to children that expect it.
Case in point, a dropdown menu in a row needs the click event so it can maintain its state, or close other drop downs when the focus is changed
To solve this we can use an absolutely positioned div to act as a "Mask" or "Clip" for each TableCell that passes the onRowClicked handler to the "Clip" div instead of the TableCell. In other words, we no longer make the Row respond to click events, but the individual table cells.
When column.ignoreRowClick = true, it will not render a "Clip" div thereby making the TableCell "non-clickable"
Technically, onRowClick
doesn't make sense as a prop name, but it is less confusing than onTableCellClicked
as an api, giving the illusion that the row can be clicked when it's actually the "Clip" div that is listening for the click event.
To illustrate, the red masks are onRowClick
clickable cells and the white column is ignored (via ignoreRowClick
.
![screen shot 2018-04-22 at 7 44 24 am](https://user-images.githubusercontent.com/1385932/39094657-15119e82-4601-11e8-9d98-998595179162.png)
To mitigate performance issues with this approach, we can use event-delegation to prevent too TableCells from creating their own onclick event listener