Skip to content

Question: rowClick throws error in react functional component #264

Open
@arusikgrigorian

Description

@arusikgrigorian

Environment Details:
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-tabulator": "^0.18.1",

Issue Description:
While clicking on a row apart from getting the required information I'm getting an error. Here it is:

//error
Uncaught TypeError: component.getComponent is not a function
at Interaction.dispatchEvent (Interaction.js:293:1)
at Interaction.handle (Interaction.js:239:1)
at InternalEventBus.js:130:1
at Array.forEach ()
at InternalEventBus._dispatch (InternalEventBus.js:129:1)
at InteractionManager.dispatch (CoreFeature.js:78:1)
at InteractionManager.triggerEvents (InteractionMonitor.js:302:1)
at InteractionManager.track (InteractionMonitor.js:204:1)

//required information
//PointerEvent {isTrusted: true, pointerId: 1, width: 1, height: 1, pressure: 0, …}
//{title: 'some title', assignees: Array(1), description: '', milestone: 'some milestone', labels: Array(1), …}

Question:
How can I fix it or simply not to get that error ?

Code:
const Component = () => {
//some constants here

const { loading } = useQuery(MY_QUERY {
onCompleted: (data) => {
//some code here
},
onError: (err) => {
//some code here
},
}

const rowClickHandler = (e, row) => {
console.log(e, row.getData());
}

return (
//some checking to display the error component or the loader
<>
//other components

        <ReactTabulator
         data={data}
         columns={columns}
         events={{ rowClick: rowClickHandler }}
         />

     </>
 )

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions