DataTables logo DataTables

via Ad Packs
Specifiying Column Width is not working
  • I am using Datatables 1.8.1 along with TableTools. For one of my columns I entered a long character string (>200 chars) and it completely messed up my table in that it enlarged the column (and hence table) to accommodate. I was using autowidth so I turned that off and specified a width of "200px". The first time the table is drawn the Header is correctly 200px. Stepping through the DT code the table gets redrawn on the statement "o.nTable.insertBefore( nTheadSize, o.nTable.childNodes[0] );" which is in the _fnScrollDraw function.

    I can't post the code but here is similar code:

    var myTable = $('#myTable').dataTable( {
      "bFilter": false,
      "bInfo": false,
      "bPaginate": false,
      "bAutoWidth": false,
      "aaSorting: [[0, "desc"]],
      "aoColumns": [
        { "sType": "serial"},
        null,
        { "sWidth": "200px"},
        { "sType": "date"},
        null,
        null,
        null
      ],
      "sDom": 'T<"clear">lfrtip',
      "oTableTools": {
          "sRowSelect": "single"
       }
    });
    
    $(window).bind("resize", function() {
       myTable.fnAdjustColumnSizing();
    });
    
    

    Anybody have suggestions?
This discussion has been closed.
← All Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Support

Get useful and friendly help straight from the source.