Hidden scrollbar with scrollX when is not necessary

Hidden scrollbar with scrollX when is not necessary

kumikokumiko Posts: 2Questions: 1Answers: 0
edited August 2021 in DataTables 1.10

Hi, want to know if is possible, when i have a datatable with scrollX = true, hidden the scrollbar when is not necessary to make any scrolland show only when yes.
When i have the table width to 100%, the scroll bar is always show and in the right is cut like a 1px and it make a scroll.

If i put the width to 99%, the scrollbar it only show when is necessary, but the table is not align with the header

Answers

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    Take a look at this example:
    http://live.datatables.net/bisipoda/1/edit

    scrollX is showing the scrollbar when there isn't enough space to show the full table. if you open the same example in preview mode there is enough space to show the table without the scrollbar:
    http://live.datatables.net/bisipoda/1

    I suspect there is something else on your page causing the issue. Maybe the container the table is affecting the table. Please post a link to your page or a test case replicating the issue so we can help debug. You can update my example.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • kumikokumiko Posts: 2Questions: 1Answers: 0

    Ok i found the problem, i have a style that add and 1px solid border to all tables, its look when i add a border to the table its when size pass the 100% and the scroll bar appear. Thanks for all

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

    That looks like something we need to address. Thanks for flagging it up.

    Allan

Sign In or Register to comment.