Giter Site home page Giter Site logo

On row click about table HOT 3 CLOSED

tanstack avatar tanstack commented on July 19, 2024
On row click

from table.

Comments (3)

DimitryDushkin avatar DimitryDushkin commented on July 19, 2024 1

p.1 β€” that's I've done some times, but it's became too often pattern, so I think it's worth standalone feature.

Sounds good!) I'll send PR.

from table.

tannerlinsley avatar tannerlinsley commented on July 19, 2024

Options to achieve this:

  1. Place onClick handlers on your rendered elements in each cell (cumbersome, but works right now)
  2. Override the trComponent to use a custom one that implements onClick functionality
  3. Submit a PR that does the following:
  • Add an onTrClick event after (this)[https://github.com/tannerlinsley/react-table/blob/master/src/index.js#L25] with a good default noop. Probably something like:
onTrClick: () => null
  • Add an onClick handler here that will fire the onTrClick prop with all of the appropriate information about the row. eg:
onClick={(event) => this.props.onTrClick(rowInfo, event)}

I would also be okay with the prop being called onRowClick if that feels or sounds better.

Thoughts? :)

from table.

DimitryDushkin avatar DimitryDushkin commented on July 19, 2024

#23

from table.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.