Documentation menu
exportTo
exportTo(exportType:String, parameters:Object, callback:Function|String)
Exports the content from the grid to Excel, PDF or HTML. Such an export file can be saved both locally and to a server.
Parameters
Name | Type | Description |
---|---|---|
exportType | String | One of the following export types: "excel" , "pdf" or "html" . |
parameters | Object | optional Describes export parameters. Can have the following properties: |
| String | optional The name of the export file. The default name is pivot . |
| String | optional Destination for the download. By default, destinationType is set to "file" , which means the export file is saved locally. Set destinationType as "server" to save the export file to the server. |
| String | optional The URL to the server script saving the export file. It is required when saving the export file to the server (the export file is passed as a POST parameter). |
| String | optional Property to set custom sheet name when exporting to Excel. |
| Boolean | optional If true, shows the filters in exported Excel file. |
| String | optional Only for PDF and HTML export. HTML string added to the export file as a header. For example, "<div>##CURRENT-DATE##</div>" . |
| String | optional Only for PDF and HTML export. HTML string added to the export file as a footer. For example, "<div>##CURRENT-DATE##</div>" . |
| String | optional Page orientation for PDF file. By default, pageOrientation is set to "portrait" , which means the export file is saved in portrait mode. Set pageOrientation as "landscape" to save the export file in landscape mode. |
callback | Function | String | optional Callback handler, which is called after the export process is finished. |
Examples
1) Export content to Excel or PDF:
2) Export content to PDF with a custom header, save it to a server and add a callback:
webdatarocks.exportTo(
"pdf",
{
header:"<div>##CURRENT-DATE##</div>",
destinationType: "server",
url: "URL to server script saving the file"
},
function () {
console.log("Export process is finished");
}
);