How to set column widths to a jQuery datatable?

后端 未结 7 958
庸人自扰
庸人自扰 2020-12-08 02:45

I have a jQuery datatable(outlined in red), but what happens is that the table jumps out of the width I have set for the div(which is 650 px).

Here is the screen shot

7条回答
  •  星月不相逢
    2020-12-08 02:52

    Answer from official website

    https://datatables.net/reference/option/columns.width

    $('#example').dataTable({
        "columnDefs": [
            {
                "width": "20%",
                "targets": 0
            }
        ]
    });
    

提交回复
热议问题