React-table: Need to have both row click and cell click. But on cell click, both the cell click and row clicks are getting triggered

Created on 7 Apr 2020  路  1Comment  路  Source: tannerlinsley/react-table

Description
Need to have both row click and cell click.
If I click cell only cell click should be triggered.
If I click row click only row click should be triggered.
But on cell click, the row click also getting triggered.

example via Codesandbox!
https://codesandbox.io/s/wonderful-wozniak-sn3yt?file=/src/App.js

Steps To Reproduce

  1. Click on Edit button
  2. Edit click is triggering both edit button click and also row click.

table

Most helpful comment

You can use the stopPropagation() method of the click event, it would prevent the event from bubbling to the row:

            onClick={(e) => {
              onClickActionCB(row.original, "isEdit");
              e.stopPropagation();
            }}

>All comments

You can use the stopPropagation() method of the click event, it would prevent the event from bubbling to the row:

            onClick={(e) => {
              onClickActionCB(row.original, "isEdit");
              e.stopPropagation();
            }}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

panfiva picture panfiva  路  3Comments

mlajszczak picture mlajszczak  路  3Comments

pasichnyk picture pasichnyk  路  3Comments

tremby picture tremby  路  3Comments

monarajhans picture monarajhans  路  3Comments