jQuery/JS Common - Utils - pdfExporter
exportDataGrid(options) CTP
A Promise that is resolved when the grid data is prepared for export. It is a native Promise or a jQuery.Promise when you use jQuery.
This method requires the jsPDF library to export data and the jsPDF-AutoTable plugin to create tables in exported files.
You can call this method at any point in your application. In this example, we call this method in a standalone button's onClick handler:
- $(function(){
- $('#exportButton').dxButton({
- // ...
- onClick: function() {
- const doc = new jsPDF();
- DevExpress.pdfExporter.exportDataGrid({
- jsPDFDocument: doc,
- component: dataGrid
- }).then(function() {
- doc.save('Customers.pdf');
- });
- }
- });
- const dataGrid = $('#gridContainer').dxDataGrid({
- // ...
- }).dxDataGrid('instance');
- });
- <head>
- <!-- ... -->
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.0.0/jspdf.umd.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.9/jspdf.plugin.autotable.min.js"></script>
- <!-- DevExtreme sources are referenced here -->
- </head>