I am using PDFmake to create pdf file, I want to add dynamic data in the table butt the body display empty.
this one works when I print [0] but I have lots of dynamic data
getData(installation, request) {
const phases = {
layout: {
hLineWidth: function(i, node) {
return 0.45;
},
vLineWidth: function(i, node) {
return 0.45;
}
},
table: {
dontBreakRows: true,
widths: ["30%", "10%", "60%"],
body: [
[
{
text: installation.phases[0].text,
style: "cell"
},
{ text: installation.phases[0].status},
{
text: this.getFeedback(installation.phases[0]),
style: "commentCell"
}
],
]
}
};
console.log(phases);
return phases;
}
but If I use this one it create table body empty.
getData(installation, request) {
installation.phase.forEach(value =>{
const phases = {
layout: {
hLineWidth: function(i, node) {
return 0.45;
},
vLineWidth: function(i, node) {
return 0.45;
}
},
table: {
dontBreakRows: true,
widths: ["30%", "10%", "60%"],
body: [
[
{
text: data.text,
style: "cell"
},
{ text: data.status},
{
text: this.getFeedback(data),
style: "commentCell"
}
],
]
}
};
console.log(phases);
return phases;
});
}
What could be wrong here? I have tried but cannot find solution