moustacheman
moustacheman

Reputation: 1464

jQuery Datatable - Horizontal scrollbar with Bootstrap CSS

In jQuery datatable, the horizontal scroll bar doesn't appears when I include bootstrap css. I know, some styles are overriding the datatable. Can someone help me, which style is creating the problem?

Demo

Script

$(document).ready(function() {
    $('#example').dataTable( {
        "sScrollX": "100%",
        "sScrollXInner": "110%",
        "bScrollCollapse": true
    });
});

Thanks in advance.

Upvotes: 0

Views: 7187

Answers (1)

Allyanora
Allyanora

Reputation: 159

There is a style applied by bootstrap that allows max-width of the table to be 100%;

table {
    background-color: rgba(0, 0, 0, 0);
    max-width: 100%;
}

If you disable/erase this max-width then the scroll will appear. Or just overwrite the style for tables with:

table {
max-width: none !important;
}

Add the "!important" if your style doesn't overwrite bootstrap's style.

Upvotes: 1

Related Questions