Adding Fixed Column Widths - Please Help

Adding Fixed Column Widths - Please Help

mcaleermcaleer Posts: 11Questions: 2Answers: 0

Hey everyone I am a beginner with DataTables and could use your help! I am trying to adjust the width of my columns but cannot get it to work. What code should I use and where should I put it ?? Here is my code:

$(document).ready(function() {

// Setup - add a text input to each footer cell

$('#five_year tfoot th').each( function () {
    var title = $('#five_year thead th').eq( $(this).index() ).text();
    $(this).html( '<input type="text" placeholder="Search '+title+'" />' );
} );

// DataTable
var table = $('#five_year').DataTable();

// Apply the filter
table.columns().eq( 0 ).each( function ( colIdx ) {
    $( 'input', table.column( colIdx ).footer() ).on( 'keyup change', function () {
        table
            .column( colIdx )
            .search( this.value )
            .draw();
    } );
} );

} );

This discussion has been closed.