MrHertal / react-admin-json-view

JSON field and input for react-admin.
MIT License
51 stars 13 forks source link

I have some input didn't want to be delete or add. #14

Closed yujulchen closed 3 years ago

yujulchen commented 3 years ago

Hi 💦 Is there any solution to control deletable and addable? Can it work like react-json-view's demo, let enable add/delete = false then hover it'll not show icons?

螢幕快照 2021-07-14 下午21 42 16 下午

I have some input that didn't want to be delete or add. I had tried to use onDelete or onAdd in reactJsonOptions but didn't work...

MrHertal commented 3 years ago

Hi,

you can use all the options that react json view offers in the reactJsonOptions props.

yujulchen commented 3 years ago

Hi I tried to use it like this but the delete icon is still on there.

        <JsonInput
          source="source"
          defaultValue={{...}}
          reactJsonOptions={{
            name: "name",
            collapsed: true,
            enableClipboard: false,
            displayDataTypes: true,
            onDelete: false,
          }}
        />
螢幕快照 2021-07-27 下午19 27 43 下午

ReactJsonOptions seems should work like the react-json-view demo's defaults? https://github.com/mac-s-g/react-json-view/blob/7c154b9a7d83ea89dce2c171ebdf4d163ff49233/demo/src/js/components/Demo.js#L23-L36

MrHertal commented 3 years ago

Hi, you are right there was a bug with the props onAdd, onEdit and onDelete

It's now fixed by this release.