how hide duplicate row in 1 column with "rowCallback": function

how hide duplicate row in 1 column with "rowCallback": function

deeprojectdeeproject Posts: 2Questions: 1Answers: 0
edited March 2022 in DataTables

hi, i manage to detect duplicate value in 1 colomn , how to hide/remove until only one remain

please help me

my code as follow

$(document).ready(function() {
            $('#example').DataTable({
                dom: 'Blfrtip',
                mark: false,
                'pageLength': 15,
                searchHighlight: true,
                responsive: true,
        "rowCallback": function( row, data, index ) {
        var allData = this.api().column(1).data().toArray();
        if (allData.indexOf(data[1]) != allData.lastIndexOf(data[1])) {
        $('td:eq(1)', row).css('background-color', 'Yellow');
          }
        },
    });
            $('#filter').keyup(function(){
            $('#example').DataTable().search($(this).val()).draw() ;
            searchHighlight: true;
            });
            
        } );

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 14,610Questions: 1Answers: 2,493
    Answer ✓

    This example from this thread is demonstrating that - take a look at the "aTiger" line,

    Colin

  • deeprojectdeeproject Posts: 2Questions: 1Answers: 0

    thankyou , this solved my case

Sign In or Register to comment.