$scope.selectObjectType = function () {
$scope.selected = []; // reset previous selection
$scope.model.allItemsSelected = true; // all are selected by default unless...
// If any object type is not checked, then uncheck the "allItemsSelected" checkbox
for (var i = 0; i < $scope.model.objectTypes.length; i++) {
if (!$scope.model.objectTypes[i].isChecked) {
//$scope.selected.splice($scope.model.objectTypes[i].value);
$scope.model.allItemsSelected = false;
return;
} else {
if ($scope.selected.indexOf($scope.model.objectTypes[i].value) == -1) {
$scope.selected.push($scope.model.objectTypes[i].value);
}
}
}
};
// Triggered when the checkbox "Show All" is checked
$scope.selectAll = function () {
// Loop through all the object types and set their isChecked property accordingly
for (var i = 0; i < $scope.model.objectTypes.length; i++) {
$scope.model.objectTypes[i].isChecked = $scope.model.allItemsSelected;
}
};
When I click on either "Show Activated" or "Show Inactivated" in the list, it adds to the array of selected items. However, if I click on "Show InActivated" first, it does not add to the array.
The same process applies when removing items from the selection.
I would appreciate any assistance in meeting this requirement.