while using dropdown search table alignment was mismatching

while using dropdown search table alignment was mismatching

umamagheswariumamagheswari Posts: 1Questions: 1Answers: 0
edited December 2015 in Free community support

table header nd table content was mismatching

$('#ProjTB').DataTable({
"scrollX": true,
"ordering": false,
"info":false,
//"scrollCollapse": true,

                "pageLength": 4,
                "responsive": true,
    initComplete: function () {
        this.api().columns().every(function () {
            var column = this;
            var select = $('<select><option value=""></option></select>')
                .appendTo($(column.header()).empty())
                .on('change', function () {
                    var val = $.fn.dataTable.util.escapeRegex(
                        $(this).val()
                    );

                    column
                        .search(val ? '^' + val + '$' : '', true, false)
                        .draw();
                });

            column.data().unique().sort().each(function (d, j) {
                select.append('<option value="' + d + '">' + d + '</option>')
            });
        });
    }
});
</script>
This discussion has been closed.