individual column filtering

individual column filtering

jedyjedy Posts: 1Questions: 1Answers: 0
edited April 14 in DataTables

Hi, i used this code to individual column filtering but how to disable/hidden first column if i dont want to?

$(document).ready(function() {
    $('#example thead tr').clone(true).appendTo( '#example thead' );
    $('#example thead tr:eq(1) th').each( function (i) {
        var title = $(this).text();
        $(this).html( '<input type="text" placeholder="Search '+title+'" />' );
 
        $( 'input', this ).on( 'keyup change', function () {
            if ( table.column(i).search() !== this.value ) {
                table
                    .column(i)
                    .search( this.value )
                    .draw();
            }
        } );
    } );

    var table = $('#example').DataTable( {
        orderCellsTop: true,
        fixedHeader: true
    } );
} );

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 12,939Questions: 0Answers: 2,204
    Answer ✓
    $('#example thead tr:eq(1) th').each( function (i) {
    

    This will do all the headers, so you need to restrict the theads you want to put the input elements onto, or just specifically state the ones you do.

    Colin

Sign In or Register to comment.