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?

giovanni.braccigiovanni.bracci Posts: 13Questions: 2Answers: 3

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

Answers

This discussion has been closed.