|
App.component.html
<div class="control-section">
<ejs-grid #grid [dataSource]="data" [columns]="columns"> </ejs-grid>
<ng-template let-data #template1>
<ejs-checkbox
(change)="onChange($event)"
[checked]="data[data.column.field]"
></ejs-checkbox>
</ng-template>
</div> |
|
App.component.ts
ngOnInit(): void {
this.columns = [
{
field: "id",
headerText: "Employee ID",
width: "90"
},
{ field: "Template", headerText: "Template", width: "90" },
{
field: "All",
headerText: "All",
width: "90"
},
{
field: "Input",
headerText: "Input",
width: "90"
},
{ field: "View", headerText: "View", width: "90" },
{
field: "MarkComplete",
headerText: "MarkComplete",
width: "90"
}
];
}
onChange(args) {
let row = parentsUntil(args.event.target, "e-row", false);
if (row) {
row.querySelectorAll(".e-checkbox").forEach(element => {
(element as any).ej2_instances[0].checked = args.checked;
});
}
}
ngAfterViewInit(): void {
(this.grid.getColumns()[2].template as any) = this.temp1;
(this.grid.getColumns()[3].template as any) = this.temp1;
(this.grid.getColumns()[4].template as any) = this.temp1;
(this.grid.getColumns()[5].template as any) = this.temp1;
} |