Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Demos] Add example for creating link in cell #191

Closed
rtbishop opened this issue Aug 7, 2019 · 2 comments
Closed

[Demos] Add example for creating link in cell #191

rtbishop opened this issue Aug 7, 2019 · 2 comments

Comments

@rtbishop
Copy link

rtbishop commented Aug 7, 2019

Related to issue #120

Suggestion:
Minor suggestion, but it might be helpful to others to add a demo example (or add this in one of the existing demo examples) for creating a link within a cell (probably a frequent use case for people). I was stumped for a bit until I found the above issue instructing to use ignoreRowClick. Also under API and Usage perhaps add a note for this-

prevents the onRowClicked event from being passed on a specific TableCell column. This is really useful for a menu or button where you do not want the onRowClicked triggered. For hyperlinking text this should be set to true.

Code Snippet:
This would be for the Custom Cell - Movie List example.

const columns = [
  {
    name: 'Title',
    selector: 'title',
    sortable: true,
  },
  {
    name: 'Director',
    selector: 'director',
    sortable: true,
  },
  {
    name: 'Genres',
    selector: 'genres',

    cell: row => row.genres.map((genre, i) => <div key={i}>{genre}</div>),
  },
  {
    name: 'Year',
    selector: 'year',
    sortable: true,
  },
  {
    name: 'Poster',
    selector: 'posterUrl',
    cell: row => <img height="42px" width="80px" alt={row.name} src={row.posterUrl} />,
  },
  {
    name: 'IMBd',
    ignoreRowClick: true,
    cell: row => {
      return (
        <a href="#">IMBd link</a>
      );
    }
  }
];
@rtbishop rtbishop changed the title [Demos] Add example for creating cell links [Demos] Add example for creating link in cell Aug 7, 2019
@jbetancur
Copy link
Owner

@rtbishop I amended the Custom Cells storybook example to reflect links as well as other custom fields. This is a stopgap and probably needs some fancier examples or other real-world use cases in the future

@jbetancur
Copy link
Owner

#204

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants