Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by haritha on Sep 30, 2008 00:00
open dhtmlx forum
exporting


Hi,

I want to export grid data to excel or csv... I found the following steps in the support:

Client side code generates CVS text
b) CSV text send to server
c) Server send data back to clietn with proper headers

But can you please tell me with example how to handle it in the server side.

Thanks in advance
haritha
Answer posted by Support on Sep 30, 2008 07:57
Which server side language you are using? ( If necessary - I can provide a PHP based sample )

Basically on client side you will have

function exportCSV(){
     document.forms[0].csv.value = mygrid.serializeToCSV();
     document.forms[0].submit();
}

on server side 

header("text/csv"); // in case of Win based users , you can send ms-excell header, so file will be opened by Excel
echo $_POST['csv']; //send data back to client side, because of header, it will be treated as file