highlight the same rows from single table

highlight the same rows from single table

Khalid TeliKhalid Teli Posts: 251Questions: 71Answers: 0

Hi,
I am trying to compare the rows in table and highlight the rows with matching data.

For example, in the image below I have two columns type_of and ord_qty

1) I have type_of = FPL(from Itlay) est and value ord_qty = 8001.
2)I want to highlight, if there is a row with same type_of data which in my case is FPL(from Itlay) Firm [ignoring the est and Firm]

This is what I have come up with so far:

  'rowCallback': function(row, data, index){
var compare_table ; // table row to be compared

var comparetable = table.rows().count();

if ((data.type_of != null) && (data.ord_qty != null) )
{
compare_table =  data.type_of.replace('est', '');

}

for ( var i=0; i < comparetable; i++ )

{

var main_table = table.row(i).data().type_of.replace('Firm', '');

    if(main_table == compare_table)

     {

                $(row).addClass('compare');

    }  

}
}

It only highlights the one row as shown in picture.

Thank you

This question has an accepted answers - jump to answer

Answers

Sign In or Register to comment.