How can I do cells with the same value red?
How can I do cells with the same value red?
huelo
Posts: 5Questions: 1Answers: 0
Hello, in the test mentioned below, those who write London in data[2] are in red. but what I want to do is have the columns with the same values in data2 in red. for example, users with the same ip.
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Are you saying that you want to check for duplicates in the column and mark those red?
Kevin
yes
I've got an example that does just that: http://live.datatables.net/wisejipa/1/edit
Colin
Thanks for your help colin. But when I get the table information from sql, I get the following warning.
"DataTables warning: table id=dataTable - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3"
Have you followed the steps in the technical notes linked to in the error? That'll be the place to start,
Colin
yes, retrieve: true, does not give an warning when I do it. but this time the same columns are not red.
Likely using
retrieve: true
is not the correct fix for your problem. Why are you initializing Datatatbles more than once? Please post your relevant JS code so we can take a look.Kevin
I solved the problem. It was working 2 times because there was another code.
$(document).ready(function() { var table = $('#example').DataTable(); $('#example tbody') .on( 'mouseenter', 'td', function () { var colIdx = table.cell(this).index().column; $( table.cells().nodes() ).removeClass( 'highlight' ); $( table.column( colIdx ).nodes() ).addClass( 'highlight' ); } ); } );