Adding Width to table problem

Adding Width to table problem

veddermaticveddermatic Posts: 1Questions: 0Answers: 0
edited March 2012 in DataTables 1.9
I have a viewport that is 500px wide. By default, DataTables adds 26px in width to the table to account for the scroll bars; understandable. To have the table scroll and still fit inside the 500px wrapper, I have tried several things to no avail. How can I get the table to be 500px wide *with* scrollbars?

Here's what I have right now:

[code]
/* CSS * /
#outer { width: 500px;}
#inner {width: 474px;} /* with or without, same effect */
#theTable { width: 474px;} /* with or without, same effect */

/* HTML */



...




/* DataTable Code */
jQuery('#theTable').dataTable({
"bFilter": false,
"sScrollY": "250px",
"bPaginate": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false //makes no difference
});
[/code]

I wind up with inline styles set to 526px on .dataTable_scrollHead and .dataTable_scrollBody

Anyone have any suggestions?

Thanks!

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Can you link to an example of this happening please? DataTables shouldn't actually be adding on 26px (what platform are you using - that's a big scrollbar!?) but using the 26px from the table as my demos do when constrained to 800px. I can only guess that a bit of css, much have you have above, will be needed.

    Here is an example showing how it should work: http://live.datatables.net/ejizoy/edit (note the blue bar at the top os 500px and the DataTable aligns correctly with that).

    Allan
This discussion has been closed.