react-json-view icon indicating copy to clipboard operation
react-json-view copied to clipboard

Add onSelect feature from react-json-view

Open Bushstar opened this issue 11 months ago • 3 comments

react-json-view has the onSelect prop, it takes a function, clicking a value triggers that function.

Bushstar avatar Feb 17 '25 13:02 Bushstar

@Bushstar You can achieve a similar onSelect effect using the Row component:

<Row onClick={() => { }} />

jaywcjlove avatar Feb 17 '25 14:02 jaywcjlove

That would be great. Does this usage look correct?

const Row = JsonView.Row;

return (
    <JsonView
        value={data}
    >
        <Row onSelect={(params) => {
            console.log(params);
        }} />
    </JsonView>
);

Bushstar avatar Feb 17 '25 17:02 Bushstar

@Bushstar You can try running the example; it looks fine.

https://github.com/uiwjs/react-json-view/blob/3208d8269950a17463b9688dc9d7bac9af89aae5/core/README.md?plain=1#L379-L430

jaywcjlove avatar Feb 18 '25 00:02 jaywcjlove