Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function() {
  2.   "use strict";
  3.  
  4.     // Setup - add a text input to each footer cell
  5.     $('.table tfoot th').each( function () {
  6.         var title = $('.table thead td').eq( $(this).index() ).text();
  7.         $(this).html( '<input type="text" placeholder="Search '+title+'" class="form-control" style="background:#222;width: 95px;" />' );
  8.     });
  9.  
  10.     // DataTable
  11.     var table = $('.table').DataTable({
  12.       'iDisplayLength' : 25
  13.     });
  14.  
  15.     // Apply the search
  16.     table.columns().eq( 0 ).each( function ( colIdx ) {
  17.         $( 'input', table.column( colIdx ).footer() ).on( 'keyup change', function () {
  18.             table
  19.                 .column( colIdx )
  20.                 .search( this.value )
  21.                 .draw();
  22.         } );
  23.     });
  24.  
  25.     // hack
  26.     $('.table tr').removeClass('even');
  27.     $('.table tr').removeClass('odd');
  28.  
  29.     $('.table tr:nth-child(even)').css({
  30.       background : 'rgb(30, 30, 30)'
  31.     });
  32. }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement