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

kieronsutton00 picture kieronsutton00  路  3Comments

bdkersey picture bdkersey  路  3Comments

krishna-shenll picture krishna-shenll  路  3Comments

Abdul-Hameed001 picture Abdul-Hameed001  路  3Comments

panfiva picture panfiva  路  3Comments