Check/Deselect checkboxes button

Asked

Viewed 106 times

1

I have the check/uncheck checkbox button, it is working, but after passing through the test team, it was asked that when marking one or more checkbox with mouse, when clicked on the button it does the Uncheck and the same behavior when all checkboxes are marked by the button, if I uncheck 2 or 3 checkbox with the mouse, when pressing the button again it must Uncheck all. That is, the button will uncheck whenever there is an action performed first with the mouse.

The behavior of the button should be equal to the checkbox of the Hotmail email.

  <button class="btn btn-primary" type="button" ng-click="checkAll(participante)"
     ng-model="selectedAll"
     ng-disabled="!participante.length">
     <span><i class="glyphicon"></i> Marcar/Desmarcar Todos</span>
  </button>
     </div>

    <input type="checkbox" 
     id="checkParticipantes"
     name="checkParticipantes" 
     title="Encaminhar para autorização"
     ng-hide="!(pessoa.show_ckeckbox && pessoa.idSituacaoPagamento !== '17')"
     ng-model="checkedParticipante[pessoa.idPessoaEvento]"
     ng-change="verificaParticipanteSelecionado(pessoa.idPessoaEvento)"/>

$scope.checkAll = function (itens) {
        var checkFalse = (typeof $scope.checkedParticipante[itens[0].idPessoaEvento] == 'undefined' || $scope.checkedParticipante[itens[0].idPessoaEvento] == false) ? true: false;
        itens.forEach(function (i) {
            $scope.checkedParticipante[i.idPessoaEvento] = (checkFalse) ? checkFalse : false;
        });
    };

  • The explanation is unclear or confused ??

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.