DataTables width

DataTables width

Avalanche7592Avalanche7592 Posts: 2Questions: 1Answers: 0

I am having a problem with the datatables width. If I revert back to version 2.1.8 the width of the table is fine. With the latest versions, since 2.2.0 and up to 2.2.2, it is not getting the width correct and there is a horizontal scroll bar at the bottom and the last column has buttons in it which are getting half cut off unless I scroll over.

I tried uploading the config with the datatables debugger but it never finished. It is a table with 10 columns and the last two columns have buttons in them. The data is loaded using ajax.

Answers

  • Avalanche7592Avalanche7592 Posts: 2Questions: 1Answers: 0

    Here is a screen capture of the issue. If you watch, as I resize and drag the browser window to the right to make it bigger, there is enough space, but the datatable is redrawing and still clipping the last column off.
    As I drag it left and make the window smaller, it is redrawing up until it is at the minimum size then stops redrawing.

  • kthorngrenkthorngren Posts: 21,670Questions: 26Answers: 5,017
    edited February 14

    Previously there was a recommendation to add style="width:100%" to the table for Datatables to perform width calculations. I believe recently Datatables now adds this attribute to the table tag when initialized.

    See this example for the current behavior.

    I believe the expectation now is to control the table width by setting the width of the .dt-container div.

    This change might be interfering with something you have setup. Can you provide a link to a test case showing the issue so we can take a look? Possibly just build a simple example with an example of your table tag and container that Datatables is in would be enough.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

Sign In or Register to comment.