Skip to content

Delete option for complex renderers #1560

Open
@mohitk05

Description

@mohitk05

Is your feature request related to a problem? Please describe.
Currently it is not possible to delete a property represented by a complex renderer, i.e. one cannot delete a complete object/array from the JSON data. This is a useful feature in forms.

Describe the solution you'd like
A simple solution for this would be to include a Delete component inside every complex renderer that would set the property value to undefined.

const deleteProperty = () => {
    props.handleChange(props.path, undefined);
}
.
.
.
return (
    <Delete onDelete={deleteProperty} />
    // Renderer JSX code
)

Describe alternatives you've considered
The first approach seems straightforward, haven't thought of any alternatives yet.

Describe for which setup you like to have the improvement
Framework: React
RendererSet: Material, Vanilla

Additional context
I have successfully implemented this by writing a custom renderer, and hence this can be integrated into the default ones too. Let me know if the suggested implementation looks right, I'll create a PR for this then.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions