export class Exporting extends SampleBase {
pdfExpComplete = (args) => {
//This event will be triggered when pdf exporting.
args.promise.then((e) => {
//In this `then` function, we can get blob data through the arguments after promise resolved.
var blobURL = URL.createObjectURL(e.blobData);
window.open(blobURL);
});
};
toolbarClick(args) {
switch (args.item.text) {
case 'PDF Export':
// pdfExport(pdfExportProperties, isMultipleExport, pdfDoc, isBlob)
// if ‘isBlob’ is set as true then it will return blob data
this.gridInstance.pdfExport(null, null, null, true);
break;
}
}
render() {
return (<div className='control-pane'>
<div className='control-section'>
<GridComponent dataSource={orderDetails} ref={grid => this.gridInstance = grid} toolbar={this.toolbarOptions} allowPaging={true} allowExcelExport={true} allowPdfExport={true} toolbarClick={this.toolbarClick.bind(this)} pdfExportComplete={this.pdfExpComplete.bind(this)}>
<ColumnsDirective>
. . .
</ColumnsDirective>
<Inject services={[Page, Toolbar, ExcelExport, PdfExport, Group]} />
</GridComponent>
</div>
</div>);
}
}
render(<Exporting />, document.getElementById('sample')); |