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

192
Visualizações
In Ag grid Angular how to capitalize First letter of columnDefs

I have been looking into alternate CSS solutions to capitalize the first letter of headerName of columnDefs.

So here is my solution:-

Object.keys(row).forEach(field => {
   columnDef.push({
      field: field,
      headerName: this.customHeader(field)
   })
});

private customHeader(val: string): string {
   return val.charAt(0).UpperCase() + val.slice(1);
}

So is it possible to achieve capitalization [First letter capital and rest would be small letter] using CSS styling only for Header names in the grid.

My approach for this was:-

columnDef.push({
      field: field,
      headerName: this.customHeader(field),
      cellStyle: { color: red, textTransform: 'capitalize' }
   })

By adding cellStyle CSS styling didn't work. Two observations done here is:-

  1. color red got applied to all the cells except header of the grid.
  2. textTranform is not even applied

Please help! Thanks a lot in advance

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Ag-Grid has a feature to capitalise the field name using the field value. So if you do not pass anything as headerName Ag-Grid will automatically take your field name and capitalise the first character.

Therefore one solution is not to provide any value for headerName just provide field parameter.

Also check this link for more elaborate details

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