@Component({
selector: 'control-content',
template: ' <ejs-grid [dataSource]='data' height='350'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' [valueAccessor]='valueAccess' width='120' textAlign='Right'></e-column>
. . .
</e-columns>
</ejs-grid>'
})
export class DefaultComponent implements OnInit {
public data: Object[] = [];
public valueAccess = (field: string, data: Object, column: Object) => {
return data[field].toString().length == 5 ? this.format("###0.##0#",data[field]):this.format("0000 %",data[field]);
}
ngOnInit(): void {
this.data = orderDetails;
}
format(format,value){
let intl: Internationalization = new Internationalization();
let nParser: Function = intl.getNumberParser({ format:format});
let val: string = intl.formatNumber(value,{format: format })
return val;
}} |