ngx-datatable css styling for mouse hover
Asked Answered
L

2

9

I'm using ngx-datatable with the bootstrap theme. I can't find or figure out how to change the styling for when the mouse is hovered over a cells?. In this example it goes grey

http://swimlane.github.io/ngx-datatable/#css

I've been able to change the activation colour like this, just can't figure out the hover colour.

::ng-deep .ngx-datatable.bootstrap .datatable-body .datatable-body-
row.active {
  background-color: #006eff;
  color: #FFF;
}
Lavonia answered 17/2, 2018 at 11:53 Comment(3)
You got it to work?Rowland
@Rowland , thanks, its working great :-)Lavonia
Nice! Could you mark my answer as answer.Rowland
R
15
.ngx-datatable.bootstrap:not(.cell-selection) .datatable-body-row:hover,
.ngx-datatable.material:not(.cell-selection) .datatable-body-row:hover .datatable-row-group
{ 
   background: red;
}

This works.

Rowland answered 17/2, 2018 at 12:12 Comment(1)
copy and paste this doesn't work for me :( is there any variable I need to be aware of please?Kordofan
S
3
 :host
  ::ng-deep
  .ngx-datatable.bootstrap:not(.cell-selection)
  .datatable-body-row:hover,
:host
  ::ng-deep
  .ngx-datatable.material:not(.cell-selection)
  .datatable-body-row:hover
  .datatable-row-group {
  background: red;
}

I had to add

    :host
  ::ng-deep

and then it stared working.

You can change other default styles because there is a linear translation:

:host
  ::ng-deep
  .ngx-datatable.material:not(.cell-selection)
  .datatable-body-row:hover {
  background-color: #007bff2e;
}
Sothena answered 27/11, 2018 at 17:16 Comment(1)
how can i apply similar for selected ? the example they have for selected does not work fo rme !Chartulary

© 2022 - 2024 — McMap. All rights reserved.