jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Export Datas
Tagged: datagrid export to excel, jqxgrid
This topic contains 6 replies, has 2 voices, and was last updated by Peter Stoev 12 years, 4 months ago.
-
AuthorExport Datas Posts
-
Hi,
I’m trying to export data to an XML format.
My source data is composing of 3 values : Id, Date, Number (a float value)
Source definition is :var source = { datatype: 'json', datafields: [{ name: 'Id', type: 'number' }, { name: 'Date', type: 'date' }, { name: 'Value', type: 'number' }], data: { nodeId: '@Model.NodeId', last: '10' }, id: 'Id', url: '...' };
My grid definition is :
$('#download1TempGrid').jqxGrid({ source: dataAdapter, autoheight: true, width: '200', columns: [{ text: 'Date', datafield: 'Date', cellsformat: 'dd/MM/yyyy' }, { text: 'Time', datafield: 'Date', cellsformat: 'hh:mm:ss.sss' }, { text: 'Value', datafield: 'Value' }] });
Remark : I splitted the Date field in 2 columns, one for the date and one for the time.
My grid is well displayed.
When I export the datas, I only have 2 columns :
1.The time value
2.the float value is trunked as a int valueAnd the date value has disappeared.
Below the XML file with 10 rows:
02:46:35.3535
1502:46:35.3535
1402:46:35.3535
002:46:35.3535
3002:46:35.3535
1402:46:35.3535
1502:46:35.3535
1202:46:35.3535
2302:46:35.3535
202:46:35.3535
9Thanks for your help
SylvainHi SylvainD,
The column’s datafield is expected to be an unique setting. In your Grid, you have 2 columns with the same datafield. That should be the reason for that behavior.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThat’s right for the first issue. If I put Date and Time in the same column the export is ok.
But my number is still exported as an integer and not a float.
Sylvain
Hi Sylvain,
Set the “cellsformat” of that column.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comGreat Peter.
Thanks
Hello,
last little problem : I use a french localization (I did myself) on my grid, specially for the date and to remove the thousandseparator.
The display on the grid is fine but the export datas are not. The thousandseparator is always a coma ‘,’.
Here is my french localization :
function GetLocalisation_fr() { var days = { // full day names names: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"], // abbreviated day names namesAbbr: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"], // shortest day names namesShort: ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"] }; var months = { // full month names (13 months for lunar calendards -- 13th month should be "" if not lunar) names: ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Decembre", ""], // abbreviated month names namesAbbr: ["Jan", "Fev", "Mar", "Avr", "Mai", "Jun", "Jul", "Aou", "Sep", "Oct", "Nov", "Dec", ""] }; var localizationobj = {}; localizationobj.pagergotopagestring = "Aller a:"; localizationobj.pagershowrowsstring = "Voir ligne:"; localizationobj.pagerrangestring = " à "; localizationobj.pagernextbuttonstring = "précédent"; localizationobj.pagerpreviousbuttonstring = "suivant"; localizationobj.sortascendingstring = "Tri ascendant"; localizationobj.sortdescendingstring = "Tri descendant"; localizationobj.sortremovestring = "Supprimer tri"; localizationobj.firstDay = 1; localizationobj.percentsymbol = "%"; localizationobj.currencysymbol = "€"; localizationobj.currencysymbolposition = "after"; localizationobj.decimalseparator = "."; localizationobj.thousandsseparator = " "; localizationobj.days = days; localizationobj.months = months; return localizationobj;};
Thanks
SylvainHi Sylvain,
The Grid’s localization is currently not set in the exporter so Excel will not take into account your localization settings. We will resolve that in the next release.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.