addRow function -- failing -- inserts row twice!!!

The addRow functions inserts duplicates rows.

My objective was to export the grid to excel from the client side – using a clipboard copy and paste. All seems good but 2 issues.

1 - addRow – for the column heading – inserts in to – starting point of row 1 col 1. The process below inserts 2 rows with the column headings into excel.

2 - hidden columns are exported.

FYI - I have the pro edition.

What am I doing wrong?

-AJG

function copyData(){
dhtmlx.message.defPosition=“top”;
dhtmlx.message(“Grid Clipboard copy started… Please wait”);
mygrid.addRow(1,“region_cd,club_name,name,club,m1_fname,customer,pmk_date,col_date,credit,m2_fname,m2_lname,exp_date,mt_status,cash_rebate,prev_exp_dt,person,lastname,firstname,initial,address1,address2,city,state,zip,member_id,member_type,mstatus”,0);
mygrid.setCSVDelimiter(’\t’);
mygrid.gridToClipboard();
dhtmlx.message(“Grid Clipboard copy finished.”);
dhtmlx.message(“Opening Excel…”);
var objExcel = new ActiveXObject (“Excel.Application”);
objExcel.visible = true;
var objWorkbook = objExcel.Workbooks.Add;
var objWorksheet = objWorkbook.Worksheets(1);
dhtmlx.message(“Excel paste operations started.”);
objWorksheet.Paste;
dhtmlx.message(“Excel paste operations finished.”);

}

a) instead of adding row you can call

grid.enableCSVHeader(true)

which will include the header line in the clipboard data

b) you can define which column serialize by using

grid.setSerializableColumns(“false,true,true,…”)