Bootstrap-table add title to PDF export, jspdf-autotable undefind id error

121 Views Asked by At

Trying to customize the table export on the bootstrap-table library. I tried following this post: Bootstrap-table add title to PDF export

Like this:

function DoCellData(cell, row, col, data) {}
function DoBeforeAutotable(table, headers, rows, AutotableSettings) {}

$('table').tableExport({fileName: "test.pdf",
                        type: 'pdf',
                        jspdf: {format: 'bestfit',
                                margins: {left:20, right:10, top:20, bottom:20},
                                autotable: {styles: {overflow: 'linebreak'},
                                beforePageContent: function (data) {
                                var doc = data.doc; // Internal jspdf instance
                                console.log(doc);
                                doc.setFontSize(20);
                                doc.setTextColor(40);
                                doc.setFontStyle('normal');
                                doc.text("Table Title", data.settings.margin.left, 60);
                            },
                        tableWidth: 'wrap',
                        tableExport: {onBeforeAutotable: DoBeforeAutotable,
                                        onCellData: DoCellData}}}
                       });

I have also included: https://unpkg.com/[email protected]/dist/jspdf.plugin.autotable.js

However, getting the following error with the jspdf.plugin.autotable.js: Cannot read properties of undefined (reading 'id')

enter image description here

Am I missing something?

0

There are 0 best solutions below