Reputation: 2455
Populated Angular dataTable and trying to select all checkboxes but unable to select, tried with below code. Could you please suggest me the solution. Please refer below Stackblitz for working demo
isChecked = false;
checkuncheckall() {
if (this.isChecked == true) {
this.isChecked = false;
} else {
this.isChecked = true;
}
}
Upvotes: 0
Views: 1421
Reputation: 2723
Solved your problem. Forked at Stackblitz.
Changes:
checkuncheckall
function:if (this.persons && this.persons.length) { this.persons.forEach(f => (f.check = this.isChecked == true)); }
columns: [ { name: "" }, { data: "index" }, { title: "Dropdown" }, { title: "ExtraColumn" }, { data: "firstname" }, { data: "lastname" } ]
Upvotes: 2