[Bug Report] scrollX: true causes table to expand continuously

[Bug Report] scrollX: true causes table to expand continuously

mtryczakmtryczak Posts: 2Questions: 1Answers: 0
edited September 11 in Free community support

Test case: https://live.datatables.net/qazibeja/1

Using scrollX: true in a container that expands to fit its content (e.g. with width: min-content) will cause the table to expand continuously. To trigger this in the above example, page forward a few times, or set the entries per page to 25.

Because the data in the table is rather sparse, the above example does not expand very far, however in tables with more data, especially those that need a scroll bar to display all content, the table will continue expanding until it has filled the entire page.

This behavior is first observable in v2.2.0 - in which is it very observable, because the table begins expanding without any interaction. From what I can tell, from v2.2.0 onwards, the content is rendered slightly too large.

This is effectively a duplicate of https://datatables.net/forums/discussion/81349 however the report does not provide a test case, and I am unable to leave a comment there.

Answers

  • allanallan Posts: 65,061Questions: 1Answers: 10,773 Site admin

    Hi,

    Many thanks for the test case. I've just tried it in both Firefox and Chrome, but I don't get the continuously expanding effect unfortunately. When I set the page length to 25 I do see a small increase in width, a few px which causes the columns to realign, but it stops there. I've tried the paging as well, but it is the same.

    Is there anything else I need to do to trigger it happening?

    Thanks,
    Allan

  • mtryczakmtryczak Posts: 2Questions: 1Answers: 0

    This example is a bit more pronounced: https://live.datatables.net/qazibeja/2 (change the entries per page to 25). In order to expand continuously the table would need a bit more data, I've experienced this with as few as 12 columns.

    the content is rendered slightly too large

    I believe this is the underlying cause of the issue. Content that is rendered without a scollbar in 2.1.8 will be rendered with a scrollbar in 2.3.4. This over-sizing within a container that will expand to fit its content is likely what causes the chain reaction.

  • allanallan Posts: 65,061Questions: 1Answers: 10,773 Site admin

    Brilliant example - thank you. It looks like it is expanding to the point where the content fits on a single line. I will attempt to debug this and figure what is going wrong and how to address it.

    Interestingly I see the issue in Firefox, but not in Chrome.

    Allan

Sign In or Register to comment.