question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Customize selected row color

See original GitHub issue

I’m submitting a … (check one with “x”)

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior Selected column in single select mode is blue. Didn’t find any css class to overwrite in DOM explorer.

Expected behavior There should be a “selected” class on the datatable-body-row.

Reproduction of the problem See current demo at http://swimlane.github.io/ngx-datatable/#single-selection

What is the motivation / use case for changing the behavior? Customizing the css

  • Table version: 0.8.x ^9.0.0

  • Angular version: 2.0.x ^4.1.0

  • Browser: All

  • Language: CSS

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:10
  • Comments:24 (3 by maintainers)

github_iconTop GitHub Comments

30reactions
Reshad-Acommented, Sep 28, 2017

The following selector worked for me.

:host /deep/ .datatable-body-row.active .datatable-row-group { background-color: red !important; }

I hope it helps.

30reactions
Bidthedogcommented, Sep 11, 2017

The following selector works in the latest version - this removes the colour entirely and uses the row-striping if it’s turned on:

.ngx-datatable.material.single-selection .datatable-body-row.active,
.ngx-datatable.material.single-selection .datatable-body-row.active .datatable-row-group,
.ngx-datatable.material.multi-selection .datatable-body-row.active,
.ngx-datatable.material.multi-selection .datatable-body-row.active .datatable-row-group, .ngx-datatable.material.multi-click-selection .datatable-body-row.active,
.ngx-datatable.material.multi-click-selection .datatable-body-row.active .datatable-row-group {
    background-color: inherit !important;
}
.ngx-datatable.material.single-selection .datatable-body-row.active:hover,
.ngx-datatable.material.single-selection .datatable-body-row.active:hover .datatable-row-group, .ngx-datatable.material.multi-selection .datatable-body-row.active:hover,
.ngx-datatable.material.multi-selection .datatable-body-row.active:hover .datatable-row-group, .ngx-datatable.material.multi-click-selection .datatable-body-row.active:hover,
.ngx-datatable.material.multi-click-selection .datatable-body-row.active:hover .datatable-row-group {
    background-color: inherit !important;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Background Color of Selected Row — DataTables forums
Although you can use css to set the color of selected row, you cannot do the same for background-color. Is it true? Is...
Read more >
How to change color of selected row on onmousedown event
I am trying to change the color of the selected row from a table on a onmousedown event and reset all others (or...
Read more >
Styling selected rows and cell ranges in ag-Grid
Here's the CSS rule to override the default selected rows styles and set the selected row color to red. /* ROW SELECTION */...
Read more >
How to highlight active row and column in Excel - Ablebits
First, you clear the background color of all cells on the sheet by setting the ColorIndex property to 0. And then, you highlight...
Read more >
DataGrid - How to customize the selection's style of a selected ...
is there any other way to customize the row selection background color this ? Regards,.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found