Individual Column Search not working

Individual Column Search not working

pmuno007pmuno007 Posts: 2Questions: 1Answers: 0
edited February 2016 in Free community support

Hi everyone.

I am trying the code below. All the input boxes are added properly, but for some reason if I input anything on them, there is no filtering at all, nothing happens. Would appreciate if anyone would help me see what am I doing wrong.

Thanks.

Here is the code:

$(document).ready(function() {

    // Setup
    $('#outerTable thead th:gt(0)').each( function () {

        var title = $('#outerTable thead th').eq( $(this).index() ).text();

        $(this).append( '<br><input style="width:90px;" type="text" />' );

    } );

  

    // DataTable

    var table = $('#outerTable').DataTable();

  

    // Apply the search

    table.columns( ':gt(0)' ).eq( 0 ).each( function ( colIdx ) {

        var that = this;

  

        $( 'input', this.header() ).on( 'keyup change', function () {

            that

                .search( this.value )

                .draw();

        } );

    } );

} );

Answers

This discussion has been closed.