Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

189
Views
jspdf is coloring the first row and header

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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];
          }
        }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!