问题
Whats the best way to style the row selection of the primeng datatable grid? I have a checkbox and when selected the row changes to a bootstrap blue. I want to lighten the color for the row selection.
How do I do this?
回答1:
I'm not sure if you found your answer anywhere, but the CSS you're looking for is this:
body .ui-datatable .ui-datatable-data tr.ui-datatable-even.ui-state-highlight {
/*background-color handles the color of the highlighted row*/
/*color sets the color of the text*/
background-color: #0275d8;
color: #ffffff;
border-color: #0267bf;}
And:
body .ui-datatable .ui-datatable-data tr.ui-datatable-odd.ui-state-highlight {
background-color: #0275d8;
color: #ffffff;
border-color: #0267bf;}
Just paste that in your own CSS file and you can change the highlight color, border color and text color. I'm not sure if it's the best way of doing it, but I was doing it like this last week and that's how I got it working.
来源:https://stackoverflow.com/questions/42537505/primeng-datatable-row-selection-change-color