I'm trying to get the results like the following manner, Any expert inputs please to achieve this!
Expected work flow chart,
Here the default view,
Scenario 1: When click on the number "1" all the left to right and children need to highlight like the below,
Scenario 2: Considering the scenario 1 results, click on the number "3" all the left to right and children need to remove highlight like the below since 3 we consider as parent/root,
Scenario 3: Considering the default view, By default there is no selection When click on the number "18" all the parent values need to highlight like the below,
Scenario 4: Considering the Scenario 3 results , When click on the number "18" only for 18 the highlight need to be removed and like the below, Right to left parent level deselection not required for any value.
Note: Right to left parent level deselection not required for any value.
Here is the code: JSFiddle
$scope.setActivePrevNext = function (arr) {
let c;
arr.RowValues.forEach(e => {
e.isActive = !e.isActive; c = e.isActive;
});
index = $scope.groupOfCheckboxes.findIndex(x => x.Row == arr.Row);
childrenIndex = index + 1;
if ($scope.groupOfCheckboxes[childrenIndex] !== undefined) {
$scope.groupOfCheckboxes[childrenIndex].RowValues.forEach(e => {
e.isActive = c;
})
};
}
$scope.setBinary = function (id) {
$scope.groupOfCheckboxes.forEach(e => {
e.RowValues.forEach(item => {
if (item.td == id) $scope.setActivePrevNext(e);
})
});
}