jsonforms
jsonforms copied to clipboard
empty data property
Is your feature request related to a problem? Please describe.
Hi, I'd like to be able configure that If I remove some text from a control the property for that control is removed from the data object.
before editing
this.data = {}
some text
this.data = { name: "sometext" }
after removing the text from the control it stays like this
this.data = { name: "" }
I'd like to have some option to tell please delete this property from an object if it's empty.
The same problem is with arrays If I delete the last item from an array it stays like this
this.data = { items: [] }
Describe the solution you'd like
To have an option which tells delete or not delete an empty property from an object.
Describe alternatives you've considered
I have to do that manfully in my code at the moment.
Framework
Angular
RendererSet
Material
Additional context
No response
Hi @zeroamps,
I think this definitely makes sense. String controls could just always remove their entry. For arrays this would be easy to support with an UI Schema option removeWhenEmpty which is false by default. However I'm wondering what the best way would be for objects.
Do you want to contribute this for the Angular renderers?
String attributes are now removed with https://github.com/eclipsesource/jsonforms/pull/1984