Skip to content

React rowClick Event #502

@LightwithoutLisonlyight

Description

I want use a global event 'rowClick' with gridjs-react and on the docs I can't found a "react version" of this feature.
Please help.

I would also like to pass an entire json object to each table row but only render some keys of it in the cells. When I click on some row I want the whole object returned to me as I initially passed it, without the default formatting

_cells:[
    {
        _id: 'some-id',
       _data: 'my data'
    },
   {
        _id: 'some-id',
       _data: 'my data'
    },
   ....
]

So if I pass an object like this one to the "data"

  data: [
    { name: 'John', email: 'john@example.com', phoneNumber: {number: '(353) 01 222 3333',country:'US'} },
    { name: 'Mark', email: 'mark@gmail.com', phoneNumber:{number: '(01) 22 888 4444',country:'US'} },
  ]

and i render only name and email value, when i click on that row i want that the returned object to be:

     {name: 'John', email: 'john@example.com', phoneNumber: {number: '(353) 01 222 3333',country:'US'} }

(the initial object should be contained into "args") like so:

     (...args)=>console.log(args)
     // so
     (...args) = (event, formattedObjectData, initialObject)

How can I achieve this ?

Thanks ❤️

P.S.
With the button component I already solved the problem, but now I need to use the rowClick event, so without using button.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions