How to place DataTables column filter on top

前端 未结 7 2037
[愿得一人]
[愿得一人] 2020-12-08 16:29

I am using jQuery DataTables latest version. I want to use individual column filter on every table so am using the column filter plugin but am getting search boxes in foote

7条回答
  •  攒了一身酷
    2020-12-08 16:49

    Try this

    $(document).ready(function() {
    $('#mytable thead td').each( function () {
            var title = $('#mytable thead th').eq( $(this).index() ).text();
            $(this).html( '' );
    });
    $("#mytable thead input").on( 'keyup change', function () {
            table
                .column( $(this).parent().index()+':visible' )
                .search( this.value )
                .draw();
    });
    });
    

提交回复
热议问题