Hello,
I’m new to JsonForms - looks like a great project!
I am exploring customRenderers and am puzzled why they don’t seem to obey conditions. I am wanting to display additional help text dependent on the value of some fields but couldn’t get the condition to work. I see the same problem in the seed project and can reproduce as below:
. For example:
Clone the seed project, install dependencies and start
Copy and paste the condition in uiSchema.json from ‘recurrence_interval’ to ‘rating’ which has a custom renderer.
When setting recurrence to ‘Never’ the recurrence_interval control gets hidden, but the rating control is still visible.
Is this a bug or am I missing something, and do custom renderers need additional configuration to have conditions applied? If I copy and paste the condition into other fields (e.g due date, description) the conditions work just fine.
Thanks!
Hi @otter606 ,
thanks for your interest in JsonForms
Rules are not applied automatically to controls - including custom controls - but the calculated enabled and visible state is supplied to controls in their props via the control’s appropriate higher order component.
Each control is then responsible itself to apply the visible and enabled props.
In conclusion, you need to implement hiding/disabling your control based on the supplied visible resp. enabled props. The props are calculated considering the rules in the UI Schema.