jsonforms
jsonforms copied to clipboard
Is there a way to access the properties of any element rendered by json forms?
Is your feature request related to a problem? Please describe.
After the JSON form renders the UI schema say like this

If there's a change in an element say

On each data change, I only have access to the data object of the form when it is changed at the onChange callback function.
Is there a way to get a more specific detail about the changed element?
Describe the solution you'd like
I would like to have a function to get an element by a reference that could be any property that can be passed along in the JSON forms. If this already exists I would appreciate it if you can help with a solution.
Describe alternatives you've considered
The current alternative is looping through the new data and comparing it with the old data for where changes were made, then utilizing the information. The problem with my alternative is it doesn't scale well as data increases. But do help me out if you have a better approach to this.
Framework
React
RendererSet
Material
Additional context
No response
Hi @kevoese, we would like to address use cases like this with some sort of middleware support. There you could then listen to the update events and check the data path of the elements to update.
At the moment you can build something like this yourself by not using the JsonForms component but implementing your own version of the JsonFormsStateProvider to add your own middleware.
Of course you could also go the custom renderers route, but then you need to reregister all existing controls, each with a different handleChange method which you control.
Thanks for the response. I will check this out.
I can also recommend fast-json-patch to calculate a diff between the old and the new data. Using this you get a nice description of what actually changed with each update.
I'll close this issue for now as there are some workarounds like fast-json-patch which can be used for this. For the foreseeable future we'll not support more detailed change notifications.