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

182
Views
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 answers
Answer question

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 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!