Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript" language="javascript" class="init">
- $(document).ready(function() {
- // Setup - add a text input to each footer cell
- $('#example tfoot th').each( function () {
- var title = $('#example thead th').eq( $(this).index() ).text();
- $(this).html( '<input type="text" placeholder="Search '+title+'" />' );
- } );
- // DataTable
- var table = $('#example').DataTable();
- // Apply the search
- table.columns().eq( 0 ).each( function ( colIdx ) {
- $( 'input', table.column( colIdx ).footer() ).on( 'keyup change', function () {
- table
- .column( colIdx )
- .search( this.value )
- .draw();
- } );
- } );
- } );
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement