Fixes: U4-7575 Deselecting items in the MNTP are not deselected
This commit is contained in:
@@ -267,12 +267,23 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController",
|
||||
|
||||
function multiSelectItem(item) {
|
||||
|
||||
var i = $scope.model.selection.indexOf(item);
|
||||
var found = false;
|
||||
var foundIndex = 0;
|
||||
|
||||
if (i < 0) {
|
||||
$scope.model.selection.push(item);
|
||||
if($scope.model.selection.length > 0) {
|
||||
for(i = 0; $scope.model.selection.length > i; i++) {
|
||||
var selectedItem = $scope.model.selection[i];
|
||||
if(selectedItem.id === item.id) {
|
||||
found = true;
|
||||
foundIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(found) {
|
||||
$scope.model.selection.splice(foundIndex, 1);
|
||||
} else {
|
||||
$scope.model.selection.splice(i, 1);
|
||||
$scope.model.selection.push(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user