Unable to set width of column? The width size is huge.

Unable to set width of column? The width size is huge.

sahu_golusahu_golu Posts: 3Questions: 2Answers: 0
$(document).ready(function() {
$("#dataTables-example';echo $j; echo'").DataTable( {
    initComplete: function () {
        this.api().columns().every( function () {
            var column = this;
            var select = $("<select><option value=\"\"></option></select>")
                .appendTo( $(column.footer()).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>" )
            } );
        } );
    },
    "autoWidth": false,
    "columnDefs": [
            { "width": "300px", "targets": 0 }]
} );

} );

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin
    Answer ✓

    "autoWidth": false,

    I'd suggest removing that to start with.

    If it still doesn't work, please link to a test case showing the issue.

    Allan

This discussion has been closed.