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

193
Views
How to apply the same row color when the row is expanded for a table

Hi I have an issue please help me to fix it

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

0

Since your background coloring will NOT depend on the even/odd index information, you should simply use another approach for the styling.

What I would do personally is use CSS classes to identify the initial even/odd rows and when a row get extended give its children the same class.

You didnt share the 'expand' code so I do not really know how you could do that but something like that:

<tr
  key={i}
  className={`Itable-row-default table-row-${i} ${i%2 === 0 ? 'table-white' : 'table-grey'}` }
>
  <td colspan={columnData.length + 1}>
    {dataExpand[i]}
  </td>
</tr>

And the associated css

tr {
  &.table-gray {
    background: gray;
  }
  &.table-white {
    background: white;
  }

}

Depending on the 'onExpandHandler' method & the format of your initial model this might need some adaptations though :)

(oh and you should favor screenshots for images :p)

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!