colorcoded rows according same values in column

colorcoded rows according same values in column

haraldharald Posts: 16Questions: 7Answers: 1

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: 20,425Questions: 26Answers: 4,794

    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.