Skip to content

Commit

Permalink
Merge pull request #2716 from plattdl/master
Browse files Browse the repository at this point in the history
Fix ShowButton in Datagrids using rowClick
  • Loading branch information
fzaninotto authored Jan 3, 2019
2 parents c77e0e0 + 4ee495e commit 7bcf6cb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/ra-ui-materialui/src/button/ShowButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { linkToRecord } from 'ra-core';

import Button from './Button';

// useful to prevent click bubbling in a datagrid with rowClick
const stopPropagation = e => e.stopPropagation();

const ShowButton = ({
basePath = '',
label = 'ra.action.show',
Expand All @@ -18,6 +21,7 @@ const ShowButton = ({
component={Link}
to={`${linkToRecord(basePath, record.id)}/show`}
label={label}
onClick={stopPropagation}
{...rest}
>
{icon}
Expand Down

0 comments on commit 7bcf6cb

Please sign in to comment.