xscroll not working with filters!!

xscroll not working with filters!!

erferfSsderferfSsd Posts: 2Questions: 2Answers: 0
edited May 2014 in DataTables 1.10

i use 1.10 version : "scrollX": true in my datatable
but when i try to use EXAMPLES Individual column filtering (text inputs)
those search input boxs did not work ! they can not send requests to server.

do i have to change sth to make it work with "scrollX":?thanks

 // Setup - add a text input to each footer cell
    $('#example tfoot th').each( function () {
        var title = $('#example thead th').eq( $(this).index() ).text();
        $(this).html( '<input type="text" placeholder="Search '+title+'" />' );
    } );
 
    // DataTable
    var table = $('#example').DataTable();
     
    // Apply the filter
    $("#example tfoot input").on( 'keyup change', function () {
        table
            .column( $(this).parent().index()+':visible' )
            .search( this.value )
            .draw();
    } );

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Try:

    $( table.table().footer() ).on( 'keyup change', 'input', function () {
    

    i.e. use the table().footer() method to get the footer element. The problem is that the table is split into three when scrolling is enabled, so your selector isn't matching the footer.

    Allan

This discussion has been closed.