In my current records:
The parts with IDs 14.3, 14.2, and 14.1 belong to part ID = 30.
The goal is to achieve the following:
1) By default, the first two IDs will be selected. If a user tries to select ID = 71, which belongs to part 30, they should not be allowed because a higher version of part 30 (ID = 76) is already selected.
2) If a user unchecks ID = 77(33), then they should be allowed to check ID=71 because there are no different parts selected. The user should be allowed to check all parts with ID = 30 but as soon as a different part is selected, the lower part should be unchecked.
Issue with the code:
1) When I uncheck 16.1 and try to check 14.2, I am not allowed to do so even though there are no different parts selected.
2) Both 16.1 and 14.3 are checked by default. Now if I check 15.1 and then check 14.1, it causes 14.3 to get unchecked, which is incorrect as 14.3 is the highest among part ID = 30, so I shouldn't be able to check 14.1.
var app = angular.module('myApp', []);
app.controller('myCtrl', function ($scope) {
$scope.myArray = [
{
"id": 77,
"selected": true,
"part": 33,
"name": "16.1",
},
// Include the rest of the array items here...
];
// Function for checking item selection logic
$scope.checkItem = function (item) {
// Write your logic here
};
});
<!DOCTYPE html>
<html ng-app="myApp" ng-controller="myCtrl">
<!-- HTML content removed -->
</html>