colorcoded rows according same values in column

colorcoded rows according same values in column

haraldharald Posts: 9Questions: 3Answers: 0

Hello,
I am looking for a way to highlight rows with the same value in a specific column. The color should change with the value. During my search I found:

createdRow: function( row, data, dataIndex){
    $(row).addClass(data.color);
  }

But I also found this page:
https://legacy.datatables.net/release-datatables/examples/basic_init/table_sorting.html

Is this feature allready integrated? Because this is, what I am looking for.

Happy for some answer. Thanks!

Regards
Harald

Answers

  • kthorngrenkthorngren Posts: 14,649Questions: 25Answers: 3,478

    Is this feature allready integrated?

    No. Looking at the source code each row has a class assigned, for example <tr class="gradeC">. This class is coloring the rows, its not dynamic or generated by Datatatbles.

    Using createdRow is the way to go. Here is a live example.

    Kevin

Sign In or Register to comment.