I am trying to color only the first row , It is working well but the problem it is coloring the header also in the same time, Do anyone has an idea? I am using jspdf This is the snippet code
if (new Date(tableaudate[0]).getDay() === 0) {
if (data.row.index === 0) {
data.cell.styles.fillColor = [211, 211, 211];
console.log(data);
}
}
I have added this piece of code after in order to overwrite any style but it is not working :
options.headStyles = {
fillColor: [23, 55, 100],
textColor: '#FFFFFF',
minCellHeight: 8,
fontSize: 8
};
It is applying the style of the first row in the header. Please do anyone has an idea about this problem?
In fact the problem comes that head and body have same index so to distinct this is the solution : added this piece of code
&& data.row.section !== 'head'
if (new Date(tableaudate[0]).getDay() === 0) {
if (data.row.index === 0 && data.row.section !== 'head') {
data.cell.styles.fillColor = [211, 211, 211];
}
}