0
I need to understand this section of js code that is responsible for calculating the positioning of rows and columns, from a html table, to PDF.
$(el).find('tbody').find('tr').each(function(index,data) {
rowCalc = index+1;
if (rowCalc % 35 == 0){
doc.addPage();
page++;
startRowPosition=startRowPosition+10;
}
rowPosition=(startRowPosition + (rowCalc * 10)) - ((page -1) * 280);
$(this).filter(':visible').find('td').each(function(index,data) {
if ($(this).css('display') != 'none'){
if(defaults.ignoreColumn.indexOf(index) == -1){
var colPosition = startColPosition+ (index * 50);
doc.text(colPosition,rowPosition, parseString($(this)));
}
}
});
});
The greatest riddle is in:
Function(index, date)
I cannot understand what this function represents and what the values of the index and date parameters are.
in the case would have only a console.log(index, data) that would iterate 3 times right?
– V.Avancini
Exactly! The console.log will only be one, I put the three to show all iterations that will happen.
– Raryson Pereira Rost
show! thank you so much
– V.Avancini