I'm creating a document with pdfMake. In my document, I have three tables: the first show the three best equipments, the second shows the three worst equipments and the third shows all the equipments. It happens that the first table prints ok, but when I try to render the next tables, it does not work as expected (see this image). The code is this:
const tableHeader = [
setTableHeader("Código"),
setTableHeader("OEE"),
setTableHeader("Disponibilidade"),
setTableHeader("Performance"),
setTableHeader("Qualidade"),
]
const equipmentsTable = [
tableHeader,
...sortedEquipsInfos.map((equip)=>[
equip.eECode,
equip.oee.toLocaleString('pt-BR', {maximumFractionDigits: 2}) + '%',
equip.availability.toLocaleString('pt-BR', {maximumFractionDigits: 2}) + '%',
equip.performance.toLocaleString('pt-BR', {maximumFractionDigits: 2}) + '%',
equip.quality.toLocaleString('pt-BR', {maximumFractionDigits: 2}) + '%',
])];
...
const contentAux = [];
contentAux.push({
table: {
body: [
equipmentsTable[0], //header
equipmentsTable[equipmentsTable.length - 3],
equipmentsTable[equipmentsTable.length - 2],
equipmentsTable[equipmentsTable.length - 1],
]
}
});
contentAux.push({
table: {
body: [
equipmentsTable[0],
equipmentsTable[1],
equipmentsTable[2],
equipmentsTable[3],
]
}
})
contentAux.push(
{
table: {
body: equipmentsTable
},
}
)
...
var pdfDoc = printer.createPdfKitDocument({
...
content: contentAux
If I coment the first table, the second works fine. If I coment the first and the second, the third works. Any idea of what is happening?