jquery ajax search filter table

Solutions on MaxInterview for jquery ajax search filter table by the best coders in the world

showing results for - "jquery ajax search filter table"
Giuseppe
04 Jun 2020
1$(document).ready(function() {
2    // Setup - add a text input to each footer cell
3    $('#example tfoot th').each( function () {
4        var title = $(this).text();
5        $(this).html( '<input type="text" placeholder="Search '+title+'" />' );
6    } );
7 
8    // DataTable
9    var table = $('#example').DataTable({
10        initComplete: function () {
11            // Apply the search
12            this.api().columns().every( function () {
13                var that = this;
14 
15                $( 'input', this.footer() ).on( 'keyup change clear', function () {
16                    if ( that.search() !== this.value ) {
17                        that
18                            .search( this.value )
19                            .draw();
20                    }
21                } );
22            } );
23        }
24    });
25 
26} );
27