[App.component.html]
<div class="control-section">
<ejs-grid [dataSource]='data' [allowFiltering]='true'[filterSettings]='FilterOptions'>
<e-columns>
<e-column field='OrderID' headerText='Order ID'></e-column>
<e-column field='CustomerID' headerText='Customer Name'></e-column>
<e-column field='startDate' format='yyyy-MM-dd' type='date' headerText='Start date' [filter]='filter'></e-column>
</e-columns>
</ejs-grid>
</div> |
[App.component.ts]
import { Component, OnInit } from '@angular/core';
import { FilterSettingsModel, IFilter } from '@syncfusion/ej2-angular-grids';
import { DataUtil } from '@syncfusion/ej2-data';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent {
public data: Object[] = [ {
OrderID: 10248, CustomerID: 'VINET', startDate: "2020-04-01T12:16:33.113"
},
{
OrderID: 10249, CustomerID: 'TOMSP', startDate: "2020-05-01T12:16:33.113"
},
. . .
}];
public FilterOptions: FilterSettingsModel = {
type: 'Menu',
};
public filter: IFilter = {
params:{
format: 'yyyy-MM-dd'
}
};
ngOnInit(): void {
//parse the data before applying to the Grid
this.data = DataUtil.parse.parseJson(this.data);
}
} |
Hello Manviel,
I am facing the same issue, I am parsing the data as you have up there while adding format='yyyy-MM-dd' type='date'
in my html as well.
However, when I open up the page, all the data in the table disappears. It only displays the data when I remove this: format='yyyy-MM-dd' type='date'
but the date remains unformatted.
I have another question too, I could not find a how-to on the main website, please how do I make a server-side pagination call on the ejs data table?