0
votes

In ag-Grid when I change the row background color, it is working fine, but when I select the row, the color doesn't change to the blue color so I can recognize that the row is selected.

I'm using gridOptions.getRowStyle to change the row background color:

gridOptions.getRowStyle = function(params) {
    return { background: "#3a3a3a" }
}
2

2 Answers

0
votes

The way I would approach it, would be to use the rowClass option in ag-grid.

rowClass: 'my-row'

And then in your css you can define:

.ag-root .my-row:not(.ag-row-selected) {
  background-color: #3a3a3a;
}

https://embed.plnkr.co/fTENsl/

Another option, if you want a custom selected color, would be to use this:

.ag-root .my-row {
  background-color: #3a3a3a;
}

.ag-root .my-row.ag-row-selected {
  background-color: blue;
}
0
votes

if you want to change style of selected row use class in css

.ag-row-selected {
  background-color: black;
  color: white ;
  border-color: gray;
}