i'm using pdfMake (http://pdfmake.org/#/) and to make the model to export for in pdf i use that code:
function createPDF(events, date){
let docDefinition = {
content: [
{
style: 'tableExample',
table: {
headerRows: 1,
body: [
[{text: 'Horário', style: 'tableHeader1'}, {text: 'Nome', style: 'tableHeader1'}, {text: 'Descrição', style: 'tableHeader'}],
events.map((value, index)=>{
return(
[value.hora_inicio, value.title, value.description]
)
})
]
},
layout: 'lightHorizontalLines'
},
],
styles: {
header: {
fontSize: 18,
bold: true,
margin: [0, 0, 0, 10]
},
tableHeader: {
bold: true,
fontSize: 16,
color: 'black',
margin: [0,0,100,10]
},
tableHeader1: {
bold: true,
fontSize: 16,
color: 'black',
margin: [0,0,50,10]
}
}
}
pdfMake.createPdf(docDefinition).open();
}
but the .map() doesnt work, if i use any string instead of the map, it works, I dont find anything about that in documentaion and already find a question about that: PDFMake - make PDF from dynamical content (an array)
but if i use only the .map() to show data it works, and if i use some data to create the table and only use the .map to create the rows, when i export, this create the pdf without any data.
already tried to make a console.log(events) to see the data, and it's right