How to put the DataTable function for all tables at once

1

I'd like to know if I can use the function:

$('#myTable').DataTable ({
  scrolly: 300,
  paginação: false
});

For all tables in my page (at once) or if I need to set up a function for each table in my row.

    
asked by anonymous 17.11.2015 / 13:00

2 answers

2

You can use the selector by element type:

 $('table').DataTable ({ 
   scrolly: 300, 
   paging: false 
 });
    
17.11.2015 / 13:04
1

Yes, it is possible:

    $(document).ready(function() {
      $('table.display').DataTable({
        paging: false,
        scrolly: 300
      });
    })

Add a class identical to all tables (in the example, it would be display ).

I suggest you take a look at the documentation, there are examples of many features of datatable .

References:

link

link

    
17.11.2015 / 13:10