I am trying to export the content of the grid along with the header to csv. So far I’ve tried the following code but it adds an extra empty row after the header row
oGrid.enableCSVHeader(true);
var csv=oGrid.serializeToCSV();
what am I doing wrong here? I am using v.3.0 build 110713
Unfortunately the issue cannot be reproduced.
The following code works well for us.
If issue still occurs - please, provide a sample of your code with the init of your grid.
oGrid = new dhtmlXGridObject(‘gridbox’);
oGrid = setColumnValues(oGrid,jsonMetaData);
oGrid.setImagePath(“view/images/icons/”);//path to images required by grid
oGrid.enableColumnMove(true);
oGrid.enableAutoWidth(false); // if ‘true’ resizes grid to the size of individual columns
if ($.cookie(“locale”)) {
oGrid.setDateFormat($.cookie(“locale”));
}
And this is the export to csv function
function attachExportListeners(){
$("#export_grid").click(function (e) {
oGrid.enableCSVHeader(true);
var w = window.open();
var csv=oGrid.serializeToCSV();
$(w.document.body).html("<pre>"+csv+"</pre>");
});