Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

204
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda