PrimeNG DataTable Row Selection - Change Color

半世苍凉 提交于 2021-02-10 19:57:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!