New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not show default value when default value is an array #12824
Conversation
Maybe we should adjust the Demo UI page to include default values. If I have seen that correctly there are currently none... |
b917c59
to
ad1b0b6
Compare
@@ -281,6 +281,10 @@ | |||
function formatPrettyDefaultValue(defaultValue, availableOptions) { | |||
|
|||
if (!angular.isArray(availableOptions)) { | |||
if (angular.isArray(defaultValue)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I see that correctly, the defaultValue is always a string here, as it isn't converted at any point.
Guess it would need something like this when getting the defaultValue:
if (field.uiControl === 'multituple' && angular.isString(defaultValue) && defaultValue) {
defaultValue = JSON.parse(defaultValue);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sgiehl did that work for you? It still serialized it to json afterwards for me even though it did JSON.parse it (tested with debugger)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't test that before. but really doesn't work as expected. But can't figure out why right now...
ad1b0b6
to
097229e
Compare
@sgiehl is it ok to just merge for now and not show default value when default is an array/object which may be complex to show anyway? |
For me the changes simply don't work as expected. Here's an example of an multituple field that still shows the default:
|
@sgiehl can you check again? |
…12824) * Do not show default value when default value is an array * make sure a pretty value is actually set * do not show default value for multituple
Otherwise it shows a json encoded array as default value.
Especially in combination with the new form field multi tuple added in #12807