U4-8749: add back some acceidentally deleted code to deal with existing values

This commit is contained in:
Asbjørn Riis-Knudsen
2016-07-30 00:35:06 +02:00
parent 6adccb66dd
commit 1f6caa0164

View File

@@ -67,6 +67,18 @@ function sortByPreValsController($rootScope, $scope, localizationService, editor
}
});
});
// Check existing model value is available in list and ensure a value is set
var existingValue = findFromSortByFields($scope.model.value);
if (existingValue) {
// Set the existing value
// The old implementation pre Umbraco 7.5 used PascalCase aliases, this uses camelCase, so this ensures that any previous value is set
$scope.model.value = existingValue.value;
}
else {
// Existing value not found, set to first value
$scope.model.value = $scope.sortByFields[0].value;
}
}
}