how can I create a search engine for 2 datatables?

0

I found this code

var table1 = $('#table1').DataTable();
var table2= $('#table2').DataTable();
var table3= $('#table3').DataTable();
var table4= $('#table4').DataTable();
var table5= $('#table5').DataTable();

$("[aria-controls='DataTables_Table_0']").on( 'keyup', function () {
    table1.search( this.value ).draw();
    table2.search( this.value ).draw();
    table3.search( this.value ).draw();
    table4.search( this.value ).draw();
    table5.search( this.value ).draw();
} );

what it does is that in the search of the table DataTables_Table_0 if I write something it looks in the table1 ..... table5, if I write something in my main table it searches in all the other tables, it is adapted to the tables that I need but do not do anything, that code where I found it if it works but at the time of putting it where I occupy it and adapting it does not work for me or maybe that's not what I need.

    
asked by Juan Jose 25.12.2018 в 00:42
source

0 answers