Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

210
Vistas
Color handlebars table row depnding on value

How do i color a specific row in a table depending on the value in that row?

                {{#each files}}
                <tr>
                    <td style="text-align:left">{{filename}}</td>
                    {{#if status === "Completed"}}
                    <td style="text-align:right color:green">{{status}}</td>
                    {{#else status === "Pending"}}
                    <td style="text-align:right color:yellow">{{status}}</td>
                </tr>
                {{/each}}

I loop through a list of files and i want to color the status depending if the value is completed or the value is pending?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

First you'll need to make an equality helper if you aren't already using one:

Handlebars.registerHelper({
  eq: (v1, v2) => v1 === v2,
});

Then use it in the loop:

{{#each files}}
  <tr style="{{if (eq "Completed" status) "color:green"}} {{if (eq "Pending" status) "color:yellow"}}">
    <td>{{filename}}</td>
    <td>{{status}}</td>
  </tr>
{{/each}}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda