ExtJS - row renderer - if cell has certain value, highlight entire row

2.9k views Asked by At

If the column cell value is > 5000, I want to highlight that entire row. Right now I am only able to highlight that cell.

Grid column renderer:

renderer:function(val_, meta_, rec_) {
  if(val_> 5000) {
     meta_.style = "background-color:red;"; 
   }
}
1

There are 1 answers

3
CD.. On BEST ANSWER

Set getRowClass (on your grid) instead of the column renderer:

Override this function to apply custom CSS classes to rows during rendering. This function should return the CSS class name (or empty string '' for none) that will be added to the row's wrapping element.

For example:

viewConfig: {
    getRowClass: function(record, rowIndex, rowParams, store){
        return record.get("someField") > 5000 ? "row-highlight" : "";
    }
}