jsoneditor
jsoneditor copied to clipboard
Urgent problem of partial modify and provide delete function
I am using jsonedit to add, delete, check and change mongodb data in the angular project. What I want now is :
- Let jsonedit only can modify value, can not modify keys,
- You cannot add data structures. You can delete some structures, but you cannot add additional ones
- Jsonedit has the function of remove
- Verify data validity
How do you realize this requirement?can give me a simple, thanks!
Have you see the options onEditable
, schema
, and onValidate
? I think these options can more or less cover your list.
See docs: https://github.com/josdejong/jsoneditor/blob/master/docs/api.md And you can search the examples for usage examples of the mentioned options: https://github.com/josdejong/jsoneditor/tree/develop/examples
I used onEditable function, it can make keys uneditable,but when i using it the remove function has been lost.
Can you give me some short examples or related links to reference ,it is urgent. Thanks a lot!
I used onEditable function, it can make keys uneditable,but when i using it the remove function has been lost.
I'm not sure what you mean exactly. When you make a key uneditable, you can indeed not remove this field.
Okay, I see. - But can I control the insert function? If all the keys exist then disable insert, If any key is missed then enable insert function? Waiting for your replay,thanks!
Yes, you can modify the buttons shown in the context menu with the option onCreateMenu
if the default behavior of what onEditable
disabled does not match your needs.
but how can i get the context menus ? From any public object ?
No, you can implement the onCreateMenu
callback and in that callback you can add or remove buttons. There is an example here: https://github.com/josdejong/jsoneditor/blob/develop/examples/21_customize_context_menu.html