Hey Team
Is there any update on this, I want to manage Serial No in Excel Export.
[app.component.html]
<ejs-grid
#grid
[dataSource]="data"
[allowPaging]="true"
[toolbar]="toolbarOptions"
height="272px"
[allowExcelExport]="true"
(toolbarClick)="toolbarClick($event)"
(excelQueryCellInfo)="excelQueryCellInfo($event)"
>
<e-columns>
<e-column field="SerialNo" headerText="Serial No" width="150">
<ng-template #template let-data>
{{+data.index+1}}
</ng-template>
</e-column>
----
</e-columns>
</ejs-grid>
[app.component.ts]
export class AppComponent {
public serialNo: any = -1;
-----
toolbarClick(args: ClickEventArgs): void {
if (args.item.text === "Excel Export") {
this.serialNo = 0; // initialize the serial No
this.grid.excelExport();
}
}
excelQueryCellInfo(args) {
if (args.column.field == "SerialNo") {
args.value = (this.serialNo + 1).toString(); // bind the serial No in the excel cell
this.serialNo++; // increase the serial No
}
}
}
|