My data contains dates in microsoft json format /Date(1335205592410)/
The IgGrid nicely formats them automatically when I set the dataType to date.
When exporting to excel the sheet contains the json date. How could I format the date dd/mm/yyyy ? Is there a setting or do I have to write something in
cellExporting: function (e, args) {
if (args.columnKey == "MyDateField") {
..............
}
Hello Alan,
Thank you for contacting Infragistics!
To achieve the behavior you want on exporting you would have to apply the format in the cellExporting callback:
http://www.igniteui.com/help/api/2016.2/ig.gridexcelexporter#options:callbacks.cellExporting
It woudn't work on the cellExporting callback but it worked on the cellExported
cellExported: function (e, args) {
if (args.xlRow.index() == 0) {
return;
var xlRow = args.xlRow;
xlRow.cells(args.columnIndex).applyFormula('=TEXT((MID("' + args.cellValue + '",7,10)/86400)+DATE(1970,1,1),"dd/MM/yyyy")');
It's best to check the cell value first or you'll get a !#VALUE errorexportExcel() {
console.log('exporting to excel....');
jQuery.ig.GridExcelExporter.exportGrid(jQuery('#' + this.id), {
fileName: "export"
},
{
if (args.xlRow.index() == 0)
if (args.columnKey == "DateLastTransaction" || args.columnKey == "DateMaturity") {
if (args.cellValue)
xlRow.cells(args.columnIndex).applyFormula('=TEXT((MID("' + args.cellValue + '",7,10)/86400)+DATE(1970,1,1),"dd/mm/yyyy")');
});