Table columns not shrinking when paging in DataTables 2

Table columns not shrinking when paging in DataTables 2

mnarvaezmnarvaez Posts: 1Questions: 1Answers: 0

I'm having an issue while migrating from 1.13.4 to 2.1.6 where the table expands beyond the width of the bounding div, even when there are columns that could be made narrow enough to fit it within the div. The columns appear to not shrink smaller than the original width, but expand as needed. I have not had this issue with 1.13.

Here is an example using 2.1 - you'll have to reduce your screen size to ~680px wide for the effect to be obvious. The first page has relatively narrow items in the first column and long items in the second column. When you go to the second page, the items in the first column are wider, so it expands the column width to accommodate them. The second column now has narrower items, but doesn't reduce in size, causing the table width to grow.
https://live.datatables.net/vakiqequ/2

Here is an example using 1.13, where the table stays the same width the entire time, shrinking the second column to accommodate the wider first column.
https://live.datatables.net/calonuna/1

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Answer ✓

    2.1.4 works as you expected as well: https://live.datatables.net/vakiqequ/3/edit .

    The issue stems from this commit, which fixes one problem, but appears to bring a new one to the table.

    I may have to revert that change - I'll look into it more - thanks for bringing this up and the examples.

    Allan

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    I've gone ahead and reverted the change mentioned. It means the original issue is back, but I'll need to fine another way to deal with that. Or perhaps a more complete solution for both. TBC!

    Allan

Sign In or Register to comment.