I stumbled upon this error when trying to include the colSpan.
[{ text: 'header ', colSpan: 3, style: 'header', alignment: 'center' }],
you have to provide empty elements if you use colSpan/rowSpan
[{text: 'header', colSpan: 3, style: 'header', alignment: 'center'}, {}, {}],
in fact they don't have to be empty, but their content will be ignored; it's just important to keep the number of elements equal for all rows
Don't you think it's inefficient to have extra {} to be appended?
inneficient? no,
inconvenient? possibly
I'd been thinking about it for a long time before I implemented spans. Although your idea seems fine for colspans, it doesn't look natural when you start using rowspans.
So eventually I've decided to keep equal number of cells in each row
i am new to pdfMake ... so i have this doubt ? i want to have a table like this.

but when i use colspan=4 .. it gives me an error saying "Cannot read property '_minWidth' of undefined".
code:
body: [
[{ text: '', style: 'tableHeader', colSpan: 4, alignment: 'center' },{},{},{},{ text: 'Accepted', style: 'tableHeader', colSpan: 2, alignment: 'center' }, {},{ text: 'Rejected', style: 'tableHeader', colSpan: 5, alignment: 'center' },{},{},{},{},{ text: 'total', style: 'tableHeader', alignment: 'center' }],
[{ text: 'Authenticator', style: 'tableHeader', alignment: 'center' },{ text: 'Name', style: 'tableHeader', alignment: 'center' },{ text: 'Types', style: 'tableHeader', alignment: 'center' },{ text: 'Container', style: 'tableHeader', alignment: 'center' },{ text: '#', style: 'tableHeader', alignment: 'center' },{ text: '%', style: 'tableHeader', alignment: 'center' }, { text: 'ProcError', style: 'tableHeader', alignment: 'center' }, { text: 'AuthError', style: 'tableHeader', alignment: 'center' },{ text: 'lookupError', style: 'tableHeader', alignment: 'center' },{ text: '#', style: 'tableHeader', alignment: 'center' },{ text:
alignment: 'center' }, { text: 'AuthError', style: 'tableHeader', alignment: 'center' },{ text: 'lookupError', style: 'tableHeader', alignment: 'center' },{ text: '#', style: 'tableHeader', alignment: 'center' },{ text:'%', style: 'tableHeader', alignment: 'center' }, { text: 'total', style: 'tableHeader', alignment: 'center' }],
[ 'Sample value 1', 'Sample value 2', 'Sample value 3','Sample value 4', 'Sample value 5', 'Sample value 3','Sample value 6', 'Sample value 7', 'Sample value 8','Sample value 9', 'Sample value 10', 'Sample value 11','Sample value 12'],
]
thanks in advance.
Most helpful comment
you have to provide empty elements if you use colSpan/rowSpan
[{text: 'header', colSpan: 3, style: 'header', alignment: 'center'}, {}, {}],