how do change font-weight or font color using rowDataBound event?

Hi,

how do we change the font-weight or the color at runtime in the row? We use row setAttribute in the rowDataBound event but it doesn't work.

Regards

j.nord



1 Reply

PS Pavithra Subramaniyam Syncfusion Team January 2, 2018 03:02 PM UTC

Hi Jürgen, 

We have checked your query and you can achieve your requirement( change the font-weight or the color at runtime in the row) by using “rowDataBound” event by setting the required styles for row cells. Please refer to the following  code example and sample link. 
[Index.ts] 
let grid: Grid = new Grid({ 
    dataSource: data, 
    .   .   . 
    columns: [ 
                      .   .   . 
    ], 
    rowDataBound: rowBound 
}); 
grid.appendTo('#Grid'); 

function rowBound(args: RowDataBoundEventArgs) { 
    if (args.data['Freight'] < 30) { 
        args.row.classList.add('below-30'); 
    } else if (args.data['Freight'] > 80) { 
        args.row.classList.add('above-80'); 
    }  

[index.css] 

.e-grid .e-row.below-30 .e-rowcell
  color: orangered; 
  font-weight: bold; 

.e-grid .e-row.above-80 .e-rowcell
  color: greenyellow 


Regards, 
Pavithra S. 


Loader.
Up arrow icon