jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Export to Excel
This topic contains 3 replies, has 2 voices, and was last updated by ivanpeevski 1 year, 10 months ago.
-
AuthorExport to Excel Posts
-
I successfully export to excel format, but in excel format my column (date) is showing something like this value: 2023-06-27T00:00:00 or 2023-06-27T10:14:15.377
How possible I want to remove the ‘T’
Hi durian,
Can you please share an example of the Grid’s settings? The format is exporting correctly in the Export demos on our site.
Have you marked the date datafield withtype: 'date'
in the dataAdapter?Best regards,
Ivan Peevski
jQWidgets Team
https://www.jqwidgets.com/Hi ivanpeevski, below is a block of code for the dataAdapter. I have change, type: ‘date’ as shown below. However, the excel format my column (Trxn. Date) not showing the accurate date but the end of the month date, example like this value: 06/30/2023. I want the column to show date and time, for example value: 15/06/2023 1145
var source = {
datatype: “json”,
datafields: [
{ name: ‘RowNum’, type: ‘int’ },
{ name: ‘LOCA_FULL_NAME’, type: ‘string’ },
{ name: ‘TPYM_TRX_NBR’, type: ‘string’ },
{ name: ‘TPYM_REF_NBR’, type: ‘string’ },
{ name: ‘TPYM_TRXN_DATE’, type: ‘date’},
{ name: ‘TPYM_PAYMT_AMT’, type: ‘string’ },
{ name: ‘TPYM_POS_ID’, type: ‘string’ },
{ name: ‘TPYM_PLATFORM’, type: ‘string’ },
{ name: ‘LAST_VERSION’, type: ‘string’ },
{ name: ‘TPYM_TRX_TYPE’, type: ‘string’ },
{ name: ‘FILM_CODE’, type: ‘string’ },
{ name: ‘TPYM_NAME’, type: ‘string’ },
{ name: ‘SHOW_DATE’, type: ‘date’},
{ name: ‘SHOW_TIME’, type: ‘string’ }
],
id: ‘RowNum’,
localdata: ‘[{}]’,
totalrecords: 0
};// load virtual data.
var rndrDateTime = function (row, column, cellvalue) {
if (cellvalue === undefined || cellvalue === null || cellvalue === “”)
return “”;var cellvalue = $.jqx.dataFormat.formatdate(new Date(cellvalue.split(“T”)), ‘@AppSetting.DateTimeFormat’);
//return cellvalue;
return ‘<span style=”margin: 10px 3px; font-size: 12px; float: left; “>’ + cellvalue + ‘</span>’;
}var dataAdapter = new $.jqx.dataAdapter(source);
Hi durian,
The date formatting should be set with the ‘cellsformat’ property. The cellsrenderer property has no effect during the export.
Here is an example with a dd/MM/yyyy HH:mm format – https://jseditor.io/?key=jqwidgets-grid-ver-7Additionally, depending on the date format, you might have to adjust the date values before export, since Excel transforms them in the UTC timezone, which might cause the exported file to contain different values than the grid. The workaround is included in the example above.
Best regards,
Ivan Peevski
jQWidgets Team
https://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.