. . .
export class AppComponent {
. . .
queryCellInfo(args: any): void {
if(args.column.field === 'Freight') { //checked column
var arr = args.cell.innerHTML.split('.'); //split using '.'
var val ="";
for(var i: number = 0; i < arr.length; i++) {
val += arr[i]; //concatenate the values
}
var lVal = Number(val); //convert to number
args.cell.innerHTML = lVal; //set value to cell
}
}
beforeExcelExport(args: any): void {
args.gridObject.columns[3].format="N0"; //before exporting, changed the format
}
excelExportComplete(args: any): void {
(this.grid.columns[3]as any).format="N2" //after exporting reset the format
}
excelQueryCellInfo(args: any): void {
var sVal = String(args.data.Freight);
var arr = sVal.split('.');
var val ="";
for(var i: number = 0; i < arr.length; i++) {
val += arr[i];
}
var lVal = Number(val);
args.data.Freight = lVal;
}
}
|