jsPDF autotable migration ( drawRow -> didDrawCell )

Viewed 19

I have used jsPDF autotable before, and there was ' drawCell ' attribute, but in the new version, it is changed to didDrawCell.

I need to split my table after 10 rows, so I want to limit rows per page.

In the last version it works with :

doc.autoTable(res.columns, res.data, {
 drawRow: function(row) {
    if (row.index > 0 && row.index % 10 === 0) {
       doc.autoTableAddPage();
     }
   }

Now, I saw in documentation that I should use like :

  doc.autoTable(header, bodyItems, {
  didDrawCell: function (row) {
    if (row.column.index > 10 && row.cell.section === "body") {
      doc.autoTableAddPage();
    }
  },
});

But it doesn't work properly. It splits the table after every row. Any idea how to fix this ?

0 Answers
Related