gregnb / gregnb/mui-datatables

Optionally not fire onRowClick ?

Open
#982 7 comments 0 reactions 0 assignees View on GitHub
new feature
Dominant language
JavaScript
Stars
2.7k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

When adding a button to a row in a given column, I'd like to be able to click that button without onRowClick firing (or find some other way of cancelling the actions of onRowClick).

## Expected Behavior
I have a 6 column table of 'events'. When someone clicks a row, I want the onRowClick function to run -- this function loads the event (or whatever)... This works.
In column 2, I have a button on each row. When this button is pressed, I want the event downloaded (or whatever) and NOT loaded. Unfortunately, when I click the button, both the buttton's onClick method AND the onRowClick method fire. This makes sense, but I'd like a way to cancel the onRowClick firing.

I have attempted to play with setting a state variable in the 'dowload' function (Which does, in fact, run before the onRowClick function)... unfortunately, due to the async nature of setState, the variable does not actually get set in state before onRowClick runs.

I should note the 'select row' checkboxes seem to cancel running onRowClick.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.