API Multi Filter with Input Text >> How to show only filters on specific columns?
API Multi Filter with Input Text >> How to show only filters on specific columns?
Hi everybody!!!
I have implemented the code of this example: https://datatables.net/examples/api/multi_filter.html
The code is:
    $(document).ready(function() {
        // Setup - add a text input to each footer cell
        $('#instrum tfoot th').appendTo('#instrum thead').each( function () {
            var title = $(this).text();
            $(this).html( '<input type="text" placeholder="Filtro" />' );
            // $(this).html( '<input type="text" placeholder="Filtro '+title+'" />' );
        } );
     
        // DataTable
        var table = $('#instrum').DataTable();
     
        // Apply the search
        table.columns().every( function () {
            var that = this;
     
            $( 'input', this.footer() ).on( 'keyup change', function () {
                if ( that.search() !== this.value ) {
                    that
                        .search( this.value )
                        .draw();
                }
            } );
        } );        
    } );
How can I decide to show the filter fields on certain columns only, and not on every column?
Thanks a lot.
Giovanni
This question has an accepted answers - jump to answer
This discussion has been closed.
            
Answers
This thread provides an example of choosing which columns to apply filters:
https://datatables.net/forums/discussion/comment/137904/#Comment_137904
Kevin
Thank you Kevin!