Data Grid - How to Not Change Colors on Selected Row

Does anybody know of a way to force a specific data grid to not change colors when selected?

I have tried to add a “jts-row-no-select” to the rows and then set the following css in my solution:

.ag-table .ag-row-selected:not(.jts-row-no-select) {
    background-color: @table-row-selected-bg-color;
    color: @table-row-selected-text-color;
}

This doesn’t work, I’m guessing because “.ag-row-selected” is defined somewhere else (probably in the grid package). And I still need the row to be active because I have an onCellClick() event defined. In this specific grid I just don’t want the row highlighted.

So you normally want the selected row to be highlighted except for specific grid?

If so, then apply a custom class to the grid and use that in your CSS to target the rule.

.ag-table.custom-class-name .ag-row-selected {
    background-color: @table-row-bg-color;
    color: @table-row-text-color;
}
1 Like

Thanks again for the info, this method works much better.