export class AppComponent {
public data: Object[] = [];
@ViewChild('grid', {static: true})
public grid: GridComponent;
ngOnInit(): void {
this.data = orderDetails;
}
rowDataBound (args) {
// here we are calculating the serial no
var rowIndex = parseInt(args.row.getAttribute('aria-rowIndex'));
var page = this.grid.pageSettings.currentPage - 1;
var totalPages = this.grid.pageSettings.pageSize;
var startIndex = page * totalPages;
var sno = startIndex + (rowIndex + 1);
// updating the value in the first cell of the row where we have rendered a empty column for this
args.row.cells[0].innerText = sno;
}
} |