Material Renderer / React - oneOf does not jump to desired Tab page

Hi there,

I am not quite sure if I run in a common wrong usage, but as far as I see in the demo
it should be the case that the Tab-Index should be chosen automatically according to the data provided.
At least at I can reproduce the expected behavior.

Currently we are facing the problem that if we load our data that the one-of Tab-index is always set to option 1 (first index). So there is not data to show. If the user changes to the desired option, where data is already given, there is the message that the form will be deleted (which is commonly used and ok).
But, so when a user wants to check some already given data he is not able to do so and the already given data is lost, because of a mismatch between shown option Tab and available data.

We are using the one-of combinator within an array. The “title” key works well and gets displayed correctly - So a row shows the right option (title - which is referenced within the schema and combinator), but does not jump to the right Tab.

I hope I explained it comprehensible - the linked example should help to clearify. Here the ONEOF-0 and ONEOF-1 are the Options.

Could it be that our unwanted behavior is related to the newer versions for jsonforms 3.x?

Thank you for your ideas and help!

Hi @anotherUser,

It’s very hard to offer generic renderers for the combinators. Especially the automatic tab selection is very magic and also doesn’t work that well.

If you can clearly distinguish between your combinator entries, for example via an id, you can write your own combinator renderer which, instead of validating the data to try to determine the right tab, just checks the id property and therefore knows exactly what tab to show.

The whole validating approach we currently use has so many downsides that I would be happy to get rid of it and always switch to an id based approach. If you, or someone else, would like to contribute this refactoring then just write here or contact me.

Thank you for clearing up the situation. I am afraid that I am not able to dive deeper into the topic of custom rendering. We decided to try out a solution which is simpler by reworking the design of the data structure and to handle the one-of problem differently.
Hopefully we will accomplish it. :slight_smile: