Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <script type="text/javascript" language="javascript" class="init">
  2. $(document).ready(function() {
  3.  
  4. // Setup - add a text input to each footer cell
  5. $('#example tfoot th').each( function () {
  6. var title = $('#example thead th').eq( $(this).index() ).text();
  7. $(this).html( '<input type="text" placeholder="Search '+title+'" />' );
  8. } );
  9.  
  10. // DataTable
  11. var table = $('#example').DataTable();
  12.  
  13. // Apply the search
  14. table.columns().eq( 0 ).each( function ( colIdx ) {
  15. $( 'input', table.column( colIdx ).footer() ).on( 'keyup change', function () {
  16. table
  17. .column( colIdx )
  18. .search( this.value )
  19. .draw();
  20. } );
  21. } );
  22. } );
  23. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement