Black Lives Matter. Please consider donating to Black Girls Code today.

(Advanced) Adding a row select callback to DataTable (dash-table-experiments)

I know this has been asked about before, but I believe in that other thread, the user was directed to a major feature pull request, which has been in the works for at least a year, with no end in sight. And the pull request was for something much more general-purpose in scope. Basically to put any component inside a cell.

I’m looking to do something more straightforward. I have dash-table-components and am building it using npm run build-local && npm run install-local. What I want to do is add an onCellSelected event which fires a callback with the index of the selected cell. Pretty straightforward, and I even have the event working client-side.

But after several searches of the entire codebase (including dash and dash-renderer and comparisons with some of the dash-core-components), I still cannot get an event to fire.

I tried adding these to DataTable.propTypes:

dashEvents: PropTypes.oneOf(['change']),
/**
 * Dash-assigned callback that gets fired when the input changes.
 */
fireEvent: PropTypes.func

However, “fireEvent” is not defined in “this.props” in the render function of the control. Yet, if I browse the DropDown component code in dash-core-components, the “fireEvent” property is added to “this.props” in that render event.

Is this because “onChange” creates the fireEvent object for that event because ‘change’ is listed in dashEvents? And because the DataTable’s event I am using is onCellSelected? I can’t seem to find what logic determines the presence of this item. I’ve read all of the documentation that I can find, but no help to be found.

Any guidance would be helpful. I can also jump on a real-time chat one on one if that is easier. I do need this event working so that I can interact with lists of items in my app. Thanks in advance.

P.S. Not exactly a pro with React, but have a lot of dev experience otherwise. So the lack of React experience may be my issue here, but any help is appreciated.