$scope. SelectAll =false;//when I click on the Radio box, it's not all selected.$scope. Checkisall =function () {var wipecheckboxobj= $ ("input[name= ' Wipecheckbox ']:checked"); if(wipecheckboxobj.length==$scope. Datalists.length) { //Select All$scope. SelectAll =true; }Else{$scope. SelectAll=false; }}//Select All, deselect all$scope. Checkallbox =function (selectall) {var wipecheckboxobj= $ ("input[name= ' Wipecheckbox ')"); if(SelectAll) {Wipecheckboxobj.prop ("Checked",true); /**It is best not to use the following, because this will use the problem!!! The most open is the jquery--1.6 version has no attr attribute, only with prop (),
But I changed the high version of jquery Sometimes there is still a problem, the specific problem is not very clear, so it is better to use prop this attribute bar*/ //wipecheckboxobj.attr ("checked", true);}Else{wipecheckboxobj.attr ("Checked",false); }}
//Delete all selected data$scope. deleteallselecteddate =function () {var wipecheckboxobj= $ ("input[name= ' Wipecheckbox ']:checked"); if(!wipecheckboxobj| | Wipecheckboxobj.length==0){ return ; }Else{var finacialvalue= ""; //gets the ID of the selected dataWipecheckboxobj.each (function () {Finacialvalue+= ($( This). Val ()) + ","; }); //remove the last commaFinacialvalue =finacialvalue.substr (0,finacialvalue.length-1); $http ({URL:'/ecp/financial/deleteallselectedwipedata ', Method:"DELETE", param:{"Selectedwipedatas": Finacialvalue}}). Success (function (data) {if(data== ' true '){ //after the deletion succeeds give the prompt, and refreshes the data!!! var objdiv = "Objdiv"; Startobjmessage (OBJDIV); $scope. Getalladdedwipeoutdata (); }}). Error (function data) {Console.log ("Operatewipeoutctrl Bulk delete data failed!!!!" "); }); }}
<tableclass= "Table Table-hover" > <thead> <tr> <thclass= "Col-md-1" style= "Text-align:center" > <!--it's better to use ng-change than Ng-click!!!!!!!!!! Ng-click triggered the possible selectall of the value has not changed, but Ng-change must be selectall value changed before execution!!!!!!! --<input type= "checkbox" ng-model= "SelectAll" ng-change= "Checkallbox (selectall)" > select all </th> <thclass= "Col-md-1" style= "Text-align:center" > Single number </th> <thclass= "Col-md-1" style= "Text-align:center" > Newspaper sales people </th> <thclass= "Col-md-2" style= "Text-align:center" > Category (Purpose) </th> <thclass= "Col-md-2" style= "Text-align:center" > Items eyes </th> <thclass= "Col-md-2" style= "Text-align:center" > Gold Amount (yuan) </th> <!--<thclass= "Col-md-1" style= "Text-align:center" > class type </th>--> <thclass= "Col-md-1" style= "Text-align:center" > Time Room </th> <thclass= "Col-md-2" style= "Text-align:center" > Operation </th> </tr> </thead> <tbody& Gt <TR ng-model= "Topics" ng-repeat= "Item in DataLists" > <TDclass= "Col-md-1" style= "Text-align:center" ><input type= "checkbox" ng-click= "Checkisall ()" value= "{{item.id}}" name = "Wipecheckbox" ></td> <tdclass= "Col-md-1" style= "Text-align:center" ><spanclass= "Mr-badge red-bg" >{{item.orderNumber}}</span></td> <tdclass= "Col-md-1" style= "Text-align:center" ><span>{{item.reimbursement}}</span></td> <tdclass= "Col-md-2" style= "Text-align:center" ><span title= "{{item.category}}" >{{item.category}}</span> </td> <TDclass= "Col-md-2" style= "Text-align:center" ><span ng-bind= "Item.project" ></span></td> <tdclass= "Col-md-2" style= "Text-align:center" ><span ng-bind= "Item.money" ></span></td> <!--<TDclass= "Col-md-1" style= "Text-align:center" ><span ng-bind= "Item.type" ></span></td>--> <tdclass= "Col-md-1" style= "Text-align:center" ><span ng-bind= "Item.createdon" ></span></td> <tdclass= "Col-md-2" style= "Text-align:center" ><buttonclass= "Btn Btn-danger btn-xs" ng-click= "DeleteData (item.id, ' Objdiv ')" > Delete </button> | <buttonclass= "Btn btn-success btn-xs" ng-click= "Openpop (item)" > Edit </button></td> </tr> <tr ng-if= "datalists.length==0| | datalists== ' "> <TDclass= "Col-md-2" > No data </td> </tr> </tbody></table>
jquery Select all prop ("check", True) and attr ("attr", true) difference