bAutoWidth not working

bAutoWidth not working

chenschens Posts: 4Questions: 3Answers: 0
edited February 2016 in Free community support

I'm working with angular js and using datatable, I have managed to fill the data in the table dynamically but i have a problem setting the columns headers width.
After search of open discussions over the internet i got the solution of adding the attribute ''bAutoWidth" and set it to false but it just wont work. The auto with is still happening and i dont know why.
I have set the table to "table-layout: fixed" and still nothing.

Here is the code im using to build the table:

    var table = $('#campaign_table').dataTable({
        "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
        "order": [[ 1, "asc" ]],
        "bAutoWidth": false,
        "aoColumnDefs" : [ {
            'bSortable' : true,
            'aTargets' : [ fields.length - 1 ]
        }],
        "oLanguage": {
            sProcessing: "<img src='app/assets/images/loaders/ajax-loader.gif'>"
        },
        "processing" : processing,
        "aoColumns" : fields
    });

    var tableTools = new $.fn.dataTable.TableTools( table, {
            "sSwfPath": "../assets/vendors/DataTables/extensions/TableTools/swf/copy_csv_xls_pdf.swf",
            "buttons": [
                "copy",
                "csv",
                "xls",
                "pdf",
                { "type": "print", "buttonText": "Print me!" }
            ]
    });

fields variable contains:
0: Object
index: 1
mData: "text"
sTitle: "Text"
sWidth: "50px"
sign: ""

1: Object
index: 2
mData: "text2"
sTitle: "Text2"
sWidth: "30px"
sign: ""

Am i missing anything?

Answers

  • allanallan Posts: 63,210Questions: 1Answers: 10,415 Site admin

    Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.

    Information on how to create a test page], if you can't provide a link to your own page can be found here.

    Thanks,
    Allan

This discussion has been closed.