In an Angular project using JSONForms, I need to create a custom renderer with two select elements. Both selects must be within a single renderer because I have several rules linking them, and the content of the selects can be anything as long as they are related by a set/subset relationship.
The schema should be :
"setSubset": {
"type": "object",
"properties": {
"set": {
"type": "string",
"enum": ["s1", "s2", "s3"]
},
"subset": {
"type": "string",
"enum": ["a", "b", "c"]
}
}
}
UiSchema :
{
"type": "Control",
"scope": "#/properties/setSubset"
}
But how can I bind the datas so that I have ?
"setSubset": {
"set": "s1",
"subset": "b"
}
My first attemp was to implement the custom renderer like the other build-in renderer by inheriting JsonFormsControl and declaring :
schema :
"countryCity": {
"type": "string"
}
uischema:
{
"type": "setSubset",
"scope": "#/properties/countryCity"
}
And I build the data by concatenating the values of both selects as a JSON string:
"countryCity": {
"country": "FR",
"city": "Paris"
}