eclipsesource / eclipsesource/jsonforms

Delete option for complex renderers

Open
#1,560 7 comments 1 reaction 0 assignees View on GitHub
feature material react vanilla
Dominant language
TypeScript
Stars
2.7k
Forks
424
Avg merge
17d 8h
Merged PRs (30d)
1

Description

**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`.
```jsx
const deleteProperty = () => {
props.handleChange(props.path, undefined);
}
.
.
.
return (

// 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.