I have been setting up some components and using a simple choose
control to do some more complex settings under the hood with array values. The problem I am having is in setting the initial value for this control.
Based on the example put together by @whitemedia, it might once have been working to set the initial
value to the label of the choose
control. I have also tried setting the initial
to an array, similar to the method with the color-pair
control type. The first try just sets the value of the choose to the text of the label, and the second works in terms of storing the initial values, but the user sees [object Object]
in the control input, instead of it selecting the correct choose
option.
Here is my parameter json:
{
"color" : "color|global-color:primary",
"border-radius" : {
"type" : "choose",
"initial" : {
"top": "1em",
"bottom": "0em"
},
"options" : [
{ "value" : { "top" : "1em", "bottom" : "0em" }, "label" : "Top" },
{ "value" : { "top" : "0em", "bottom" : "1em" }, "label" : "Bottom" }
]
}
}
I would like the Bottom option to be the default.
By reverting to the choose
options (pressing the back arrow), the stored value in _p_local
becomes:
{
"border-radius": {
"top": "1em",
"bottom": "0em"
}
}
And trying to bring the { "top": "1em", "bottom": "0em" }
value in as the initial
winds up just showing [object Object]
in the control input when the component is first inserted.