ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: seb on November 16, 2018, 03:33:50 pm

Title: Export date type fields
Post by: seb on November 16, 2018, 03:33:50 pm
Hello,

When I export a grid with dates in a column, the dates appear as text in Excel, rather than a true date object. I have set the PQGrid column dataType: "date", so I thought this would have worked.

Please can you advise the correct method for exporting date columns?

Thank you,
Seb
Title: Re: Export date type fields
Post by: paramvir on November 16, 2018, 08:40:40 pm
Dates are exported as date objects in the examples.

What's the complete date column definition in your case, specifically column.render and column.format.
Title: Re: Export date type fields
Post by: seb on November 16, 2018, 09:01:40 pm
Hi,

My column model looks like this:

Code: [Select]
colModel: [
{ title: "Date Added", width: 100, dataType: "date", dataIndx: "date_of", format: "dd/mm/yy" }
]

My export code looks like this:

Code: [Select]
function exportGrid() {
var blob = $grid.pqGrid("exportData", {
url: "/api/excel/export.php",
format: "xlsx",
render: true,
type: "blob",
filename: "export",
sheetName: "Export"
});
}

But when I open the Excel file, the date has come through as a string, and I have to manually convert it to a date by couble-clicking in the cell.

Thanks,
Seb
Title: Re: Export date type fields
Post by: paramvir on November 17, 2018, 08:26:50 am
Works fine for me with that column definition.

Any way to reproduce the issue in the demos or share a jsfiddle so that I can look into it.