diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/multivalues.controller.js b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/multivalues.controller.js index 02b8831306..a55a40d5ec 100644 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/multivalues.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/multivalues.controller.js @@ -11,7 +11,7 @@ angular.module("umbraco").controller("Umbraco.PrevalueEditors.MultiValuesControl //make an array from the dictionary var items = []; for (var i in $scope.model.value) { - items.push({ + items.push({ value: $scope.model.value[i].value, sortOrder: $scope.model.value[i].sortOrder, id: i diff --git a/src/Umbraco.Web/PropertyEditors/ColorListPreValueEditor.cs b/src/Umbraco.Web/PropertyEditors/ColorListPreValueEditor.cs index 17dbb14fdf..e7750c4c65 100644 --- a/src/Umbraco.Web/PropertyEditors/ColorListPreValueEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ColorListPreValueEditor.cs @@ -26,6 +26,13 @@ namespace Umbraco.Web.PropertyEditors field.Validators.Add(new ColorListValidator()); } + public override IDictionary ConvertDbToEditor(IDictionary defaultPreVals, PreValueCollection persistedPreVals) + { + var dictionary = persistedPreVals.FormatAsDictionary(); + var arrayOfVals = dictionary.Select(item => item.Value).ToList(); + return new Dictionary { { "items", arrayOfVals.ToDictionary(x => x.Id, x => x.Value) } }; + } + internal class ColorListValidator : IPropertyValidator { public IEnumerable Validate(object value, PreValueCollection preValues, PropertyEditor editor) diff --git a/src/Umbraco.Web/PropertyEditors/ValueListPreValueEditor.cs b/src/Umbraco.Web/PropertyEditors/ValueListPreValueEditor.cs index 8185a3059c..6f81c9362a 100644 --- a/src/Umbraco.Web/PropertyEditors/ValueListPreValueEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ValueListPreValueEditor.cs @@ -64,7 +64,8 @@ namespace Umbraco.Web.PropertyEditors var arrayOfVals = dictionary.Select(item => item.Value).ToList(); //the items list will be a dictionary of it's id -> value we need to use the id for persistence for backwards compatibility - return new Dictionary { { "items", arrayOfVals.ToDictionary(x => x.Id, x => PreValueAsDictionary(x)) } }; + + return new Dictionary {{"items", arrayOfVals.ToDictionary(x => x.Id, PreValueAsDictionary)}}; } ///