I cannot set a width to my first column and the other columns of the table

I cannot set a width to my first column and the other columns of the table

woogmawoogma Posts: 2Questions: 1Answers: 0
edited March 19 in Free community support

Link to test case: https://jsfiddle.net/thelittlewozniak/ban0jedv/3/
Debugger code (debug.datatables.net): / - No error
Error messages shown: No error shown
Description of problem:
Hi, I have an issue with my DataTable. I tried to set a specific width for the first column named "worker," as you can see in the JSFiddle.

When I set "autoWidth" to true and also set the width to "800px", the column does not get the expected size.

columns: [
      {
        title: "Travailleurs",
        data: "worker.name",
        name: "worker",
        editField: "worker.id",
        width: "800px",
      },
      ...
]

I also tried setting the width using columnDefs, but that didn’t work either:

columnDefs: [
        { targets: 0 , width: "800px" },
    ]

Am I missing something? Can someone help me understand why this is not working?

I also disabled fixedColumns, fixedHeader, ScrollX, and ScrollCollapse, but the column size still does not change.

Thank you for your help! :)

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 64,210Questions: 1Answers: 10,597 Site admin
    Answer ✓

    Try updating to DataTables 2.2.2: https://jsfiddle.net/gL9vc1m6/ .

    Allan

  • woogmawoogma Posts: 2Questions: 1Answers: 0

    It was indeed the 2.1.8 that was not working. I updated it to 2.2.2 and it's working well.

    Thank you ! :)

Sign In or Register to comment.