Closed
Description
Hello, I've successfully created the widget to support optgroup select (i.e. categories inside a select). I'm now seeking help for the validation.
In order to generate the categories I give a dict instead of a list to my "enum" field. How can I modify the JSON validation to avoid the error .enum should be array
Here is the codepen of my implementation:
https://codepen.io/enola-guy/pen/ZEQOVEN
If you can explain me the steps missing, I would gladly open a PR in order to make this feature in the main branch :)
Metadata
Metadata
Assignees
Labels
No labels
Activity
epicfaace commentedon Jun 14, 2020
@Enola-guy thanks for your custom widget! I don't think we can merge this into the main library, though, until we have a JSON Schema-compliant approach (and in JSON Schema,
enum
must be an array, not a dict). Can you think of a JSON-schema-compliant way of using optgroups? For example, this might involve customizing the optgroups in uiSchema using something like this:This is just an idea -- let me know if you have any other thoughts / ways of doing this.
Enola-guy commentedon Jun 15, 2020
Thanks for the hint, I'm gonna try this, unfortunately it's not going to be DRY, but that's something. Will update the code today.
Enola-guy commentedon Jul 4, 2020
Hey late update, thank you so much it worked
ui:groups
did the work ! @epicfaaceepicfaace commentedon Jul 4, 2020
Would you be interested in contributing your widget to this library as a PR?
Enola-guy commentedon Jul 7, 2020
I would be very interested ! I just need to know precisely what needs to be done, I'm more of a python dev than a react one.
vladyslavarkavenko commentedon Jul 10, 2020
@Enola-guy Can you please share your working code here?
<optgroup>
tag #4374nagaozen commentedon Nov 11, 2024
I made a PR implementing this feature:
It extends the current SelectWidget to support
optgroups
atui:options
. e.g.: