Examples › Handling row clicks
To react when the user clicks on a row, pass an onRowClick handler to the DataTable. The handler receives an object with the following properties:
record→ the clicked record;index→ the index of the clicked record in therecordsarray;event→ the original React mouse event, which you can use, for instance, to check whether a modifier key was pressed.
Click on a row to see it in action:
Here is the code:
When a row click handler is provided, the rows display a pointer cursor to signal that they are clickable.
Double-clicks
The onRowDoubleClick handler receives the same arguments. Double-click on a row to see it in action:
Here is the code:
Right-clicks
To react when the user right-clicks on a row, use the onRowContextMenu handler, which receives the same arguments. Rows with a context menu handler display a context-menu cursor; call event.preventDefault() if you don’t want the browser’s own context menu to show up. Right-click on a row to see it in action:
Here is the code:
If you need to know which cell was clicked, use the onCellClick, onCellDoubleClick and onCellContextMenu handlers instead.












