Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
141181 | Nov 28,2018 03:43 PM UTC | Nov 29,2018 12:14 PM UTC | Angular - EJ 2 | 1 |
![]() |
Tags: Grid |
...
@Component({
selector: 'control-content',
template: `
<ejs-grid #grid [dataSource]='data' (dataBound)="dataBound($event)" allowPaging='true' [pageSettings]='pageSettings' [editSettings]='editSettings' [toolbar]='toolbar'>
</ejs-grid>`,
})
export class NormalEditComponent implements OnInit {
public data: Object[];
@ViewChild("grid")
public grid: Grid
public ngOnInit(): void {
this.data = orderDatas;
}
dataBound(args: any) {
for(var i = 0; i < this.grid.columns.length; i++){
(this.grid.columns[0] as any).width = 120; //setting width for column
if((this.grid.columns[i] as any).type === "date"){ //check whether the column is date column or not
(this.grid.columns[i] as any).format = {type: "date", format: "dd/MM/yyyy"}; //set date format for date columns
}
(this.grid.columns[7] as any).format = "P2"; //setting format for numeric columns
}
this.grid.refreshColumns(); //refresh grid columns
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.