Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jim on Jan 06, 2009 06:31
open dhtmlx forum
Clipboard CSV Export

I purchased dhtmlxTreeGrid Commercial Liscence last week and am having some problems.

I am using the following code as outlined in the help files:

mygrid.setCSVDelimiter(",");
var csv = mygrid.serializeToCSV();
mygrid.gridToClipboard();

Copy to clipboard works great in Internet Explorer. When I launch Safari and run the same code I get the following error:

Can't find variable: netscape
/dhtmlxGrid/codebase/ext/dhtmlxgrid_nxml.js (line 26)

Does this work in Safari? What do I need to do to also make it work in Firefox.

One other question. Is there a way to generate a CSV file for automatic download or just copy the CSV to the clipboard.

Thanks for any help anyone can provide.

Jim
Answer posted by Support on Jan 07, 2009 15:37
>>Does this work in Safari? What do I need to do to also make it work in Firefox.
Browser uses different security rules
operation with clipboard allowed in IE by default
operation with clipboard need to be enabled directly in FF  ( http://www.febooti.com/support/website-help/website-javascript-copy-clipboard.html )
operation with clipboard fully blocked in Opera and Safari 2.x, in case of Safari 3.x operation with clipboard can't be executed programmatically which still can't be used in your case.

>>Is there a way to generate a CSV file for automatic download
It will require a small server side script
a) grid generates CSV through serializeToCSV
b) data sent to the server side ( form submit )
c) same data outputed back by server side script, but with valid headers ( Ñontent-type:text/csv for example ) - it will be treated by browser as file downloading.