Fixes #3391 - Unable to open object manager select field modal if options contains invalid data (like undefined or null).

This commit is contained in:
Martin Edenhofer 2021-02-04 15:57:21 +01:00 committed by Thorsten Eckel
parent ff00eb07fb
commit b9a9cd611b

View file

@ -8,7 +8,12 @@ class App.UiElement.object_manager_attribute extends App.UiElement.ApplicationUi
params.data_option = params.data_option_new params.data_option = params.data_option_new
if attribute.value == 'select' && params.data_option? && params.data_option.options? if attribute.value == 'select' && params.data_option? && params.data_option.options?
sorted = _.map params.data_option.options, (value, key) -> [key.toString(), value.toString()] sorted = _.map(
params.data_option.options, (value, key) ->
key = '' if !key || !key.toString
value = '' if !value || !value.toString
[key.toString(), value.toString()]
)
params.data_option.sorted = sorted.sort( (a, b) -> a[1].localeCompare(b[1]) ) params.data_option.sorted = sorted.sort( (a, b) -> a[1].localeCompare(b[1]) )
item = $(App.view('object_manager/attribute')(attribute: attribute)) item = $(App.view('object_manager/attribute')(attribute: attribute))