Remove horizontal scrollbar

Remove horizontal scrollbar

cpowercpower Posts: 11Questions: 3Answers: 2

Hi,
Is there a way to remove the horizontal scrollbar completely? Thanks

http://live.datatables.net/yigexovu/2

This question has an accepted answers - jump to answer

Answers

  • isport59isport59 Posts: 30Questions: 9Answers: 2
    Answer ✓
    Have you tried the following?
    
    var table = $('#example').DataTable({
        "sScrollY": "200px",
        "sScrollX": "100%"   
     });
    
  • allanallan Posts: 63,680Questions: 1Answers: 10,498 Site admin

    The horizontal scroll bar is shown because the table takes up more width that is available horizontally!

    You could use Responsive to have it automatically hide columns to make the table fit into the available horizontal width.

    Allan

  • cpowercpower Posts: 11Questions: 3Answers: 2
    edited May 2015

    the sScrollX breaks in ie 11, and I saw "unable to get property style of undefined or null reference" error when trying to resize my window

    The Responsive is nice but I don't really need it for now. Thanks all for the suggestions.

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

    Can you try the 1.10.8-dev nightly version please.

    Allan

  • cpowercpower Posts: 11Questions: 3Answers: 2
    edited May 2015

    Same exception: o[m].style.width=null where o[m] (theader th) is undefined when resizing window. If I do not put xScrollX on, there is no crash however the theader does not move with the horizontal bar. I tried to recreate the problem using JS bin but has been unsuccessful so far.

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

    Okay thanks for letting me know. I've just tried as well but haven't managed to recreate it yet. If you do find a way, please let me know as I would like to investigate and see if I can fix it in the core if a fix is required there.

    Allan

  • cpowercpower Posts: 11Questions: 3Answers: 2

    Well, I haven't found the exact cause of the problem, but I did find a way to prevent the IE crashing from happening. My application has multiple tabs and each tab has a table inside. The table gets initialized every time when a tab is clicked, and it would crash IE if I resize the window. I found out that the table was never destroyed during tab switching. After I added " table.destroy(true); " into the termination method, the window resize does not crash IE anymore. It seems that the cleaning up of DOMs does the trick here and I am happy with the result.

    Thanks for the help Allan! All the best!

This discussion has been closed.