Alternate row background color two rows at a time

Alternate row background color two rows at a time

nettunodevnettunodev Posts: 12Questions: 5Answers: 0

Hello,
I have a simple table and everything is working fine, alternating the background color of each row... except that I would like to alternate the background color every two rows instead.
Does anybody know how I can do that?
Thanks!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Use the stripeClasses option to set a three row alternating class.

    Allan

  • nettunodevnettunodev Posts: 12Questions: 5Answers: 0

    Thanks, this is what I was looking for! Do you know if there is also a way to dynamically change this option? I mean, I would like to check a condition after the ajax call and set this option before the table is redrawn. Is there a way to do that?
    Thanks again!

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Do you know if there is also a way to dynamically change this option?

    I do know (I'm the author of DataTables), and there isn't I'm afraid. You would need to make your Ajax call yourself and then set that option in the DataTables initialisation.

    Allan

  • nettunodevnettunodev Posts: 12Questions: 5Answers: 0

    Hello, thanks again for your answers and for the amazing DataTables.

This discussion has been closed.