Nicholas
Nicholas

Reputation: 7521

Excess Whitespace beneath a DataTables

I'm using DataTables to add a rich table to my jsp page and either it or something else seems to be shoving alot of white space under the table.

Right now I the information in a and the / are created with a JSTL Core forEach loop. I though this might be the problem, but even after removing that and adding dummy data it still has excess whitespace beneath the table.

It's a simple table, the arguments are

$(".table").dataTable({
                "bInfo": false,
                "bLengthChange": true,
                "bPaginate": false,
                "bFilter": false,
                "sScrollX": "100%",
                "sScrollY": "100%",
                "bScrollCollapse": true
            });

Upvotes: 0

Views: 6188

Answers (1)

Nicola Peluchetti
Nicola Peluchetti

Reputation: 76890

Datatables creates a div with class dataTables_wrapper that wraps around the table (i think it goes between your div and the table in your case) and has a min_height of 302px and an height of 302px. The creator of datatables says that he does this to avoid clutttering, but this has some weird effects when you have little rows.

so i ususally add this in my css:

.dataTables_wrapper {
   _height: 102px;
   min-height: 102px;
}

Be careful to declare this in a css file imported after the demo_table.css.

Upvotes: 4

Related Questions