[app.component.ts]
import { Component, OnInit, ViewChild } from '@angular/core';
import { DataUtil, DataManager } from "@syncfusion/ej2-data";
import { FilterService, GridComponent } from '@syncfusion/ej2-angular-grids';
var parseData = JSON.stringify(
[
. . . .
])
// Iterate value type from JSON stringify(parseData)
var orderDataSource = JSON.parse(parseData, (field: any, value: any) => {
let dupValue: any = value;
if (typeof value === 'string' && /^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*){1})([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(value)) {
let arr: any = dupValue.split(/[^0-9]/);
let arg: any = parseInt(arr[4], 10);
let arg1: any = parseInt(arr[5], 10);
value = new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, parseInt(arr[2], 10), parseInt(arr[3], 10), arg, arg1);
}
return value;
});
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
providers: [FilterService]
})
ngOnInit() {
this.data = orderDataSource;
this.formatoptions = { type: 'date', format: 'dd/MM/yyyy' };
this.filterSettings = { type: "Menu" }
} |