columns/columndefs fixed width

columns/columndefs fixed width

matteo1991matteo1991 Posts: 5Questions: 2Answers: 0
edited September 2015 in Free community support

Hi,

I have a dataTable with several columns and I'd like to set the width of the first 2 columns (which have the same CSS class associated) to the minimum possible (let's say 20px)

in my "columnDefs" section I'm doing that:

"columnDefs": [ {
                "targets": [0,1],
                "width": "20px"
            },
            {
                "targets": 2,
                "width": "50px"
            },
            {
                "targets": [3,4,5,6,7],
                "width": "auto"
            }]

I would expect the first 2 column to be fixed at 20px each, while the Others columns, set as "auto", should fill in the rest of the available space. However this is not happening, because the first 2 columns are always bigger than what specified (around 50px or more). In addition, if the total width specified in the columnDefs is grater than the table's width, I would expect the horizontal scrollbar to appear, but this is not happening and again the width that I specify is not considered, and columns width is adjusted automatically (even if there are no columns set to "auto").
The "autoWidth" option is set to false

I'm using dataTables 1.10.2, but I tried also with version 1.10.9 without luck.
any ideas on what could be causing my issue?

Thanks

Replies

  • rodolphenrodolphen Posts: 18Questions: 4Answers: 0

    Hello,

    It works with me in datatable 10.9 but i write nothing for auto, only for fixed width.

    Rodolphe

This discussion has been closed.