[Datatable] Cocher/Décocher toutes les checkbox
Bonjour
J'utilise datatables dans mon application Angular et j'ai inséré des checkbox dans la 1ère colonne:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| this.dtColumnSearchingOptions = {
// ajax: 'fake-data/datatable-data.json',
"language": {
"url": "fake-data/French.json",
buttons: {
copyTitle: 'Ajouté au presse-papiers',
copyKeys: 'Appuyez sur <i>ctrl</i> ou <i>\u2318</i> + <i>C</i> pour copier les données du tableau à votre presse-papiers. <br><br>Pour annuler, cliquez sur ce message ou appuyez sur Echap.',
copySuccess: {
_: '%d lignes copiées',
1: '1 ligne copiée'
}
}
},
columns: [
{
title: '<input type="checkbox" id="checkall" />',
render: function (data: any, type: any, full: any) {
return '<input type="checkbox" class="checkthis" />';
}
}, |
Code:
1 2 3 4 5 6 7 8 9 10
| <table datatable [dtOptions]="dtColumnSearchingOptions" class="table table-striped row-border table-hover" *ngIf="this.temp">
<tr *ngFor="let compte of this.empData " (click)="wholeRowClick()">
<td></td>
<td>{{compte.firstName}}</td>
<td>{{compte.lastName}}</td>
<td>{{compte.job}}</td>
<td>{{compte.address}}</td>
<td>{{compte.email}}</td>
</tr> |
Cependant, je voudrai que toutes les checkbox soient cochées ou décochées lorsque je cliquerai sur celle qui est placée dans l’entête.
Comment faire?