Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- "use strict";
- // Setup - add a text input to each footer cell
- $('.table tfoot th').each( function () {
- var title = $('.table thead td').eq( $(this).index() ).text();
- $(this).html( '<input type="text" placeholder="Search '+title+'" class="form-control" style="background:#222;width: 95px;" />' );
- });
- // DataTable
- var table = $('.table').DataTable({
- 'iDisplayLength' : 25
- });
- // 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();
- } );
- });
- // hack
- $('.table tr').removeClass('even');
- $('.table tr').removeClass('odd');
- $('.table tr:nth-child(even)').css({
- background : 'rgb(30, 30, 30)'
- });
- }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement