Where can I change the background color for striped rows?

Where can I change the background color for striped rows?

rcmiller9rcmiller9 Posts: 5Questions: 1Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

Answers

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin

    This is our CSS that controls that. You can modify that and recompile as needed.

    Out of interest, what colour do you want to change the odd / even tint to? I had expected the slight opacity to cover most cases. I have been thinking of making it a CSS variable though (although auto adjusting it like we do in SCSS would be more difficult...).

    Allan

  • rcmiller9rcmiller9 Posts: 5Questions: 1Answers: 0

    In a previous version of datatables, I was able to change the default striping color by changing the following line in the 'datatables.css' file:

    table.dataTable.stripe tbody tr.odd, table.dataTable.display tbody tr.odd {
    background-color: #B0DAD7;
    }

    In the current version of datatables, I do not find that line of code in the 'datatables.css' file. Also it appears that color hex values are no longer used.

  • rcmiller9rcmiller9 Posts: 5Questions: 1Answers: 0

    Also, I don't know what code I'm seeing when I go to your link: 'This is our Css'. Is it the datatables.css file?

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin

    It's a SCSS mixin that is used for the row tinting. If you haven't used SCSS before then perhaps the easiest thing to do would be for me to compile the change for you. Want tint do you want?

    The reason it is now done this way is that it is far more flexible. You can use background colours and they will be automatically tinted for the odd / even rows.

    Allan

  • rcmiller9rcmiller9 Posts: 5Questions: 1Answers: 0

    Thank you for sticking with me on this issue.

    The color I used in the past is #B0DAD7. It's not too glaring or bawdy and it serves the purpose of helping the user to choose the correct row.

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin

    Do you mean like this? http://live.datatables.net/huwakohe/1/edit ? (I've used 1.11.1 to quickly hack it in).

    Allan

  • rcmiller9rcmiller9 Posts: 5Questions: 1Answers: 0

    That's it. Give me a couple of days so I can modify your solution to my particular data and I will report back to you.

Sign In or Register to comment.