How do you create a table with automatic column width sizing
How do you create a table with automatic column width sizing
perlmaster
Posts: 3Questions: 0Answers: 0
I am relatively new to datatables and I have run into a problem at the office. I want my table only to be as wide as it needs to be (eg. the sum of the maximum width from each of the columns). I have tried using the "bAutoWidth" option with no success. I have tried using the "aoColumnDefs" array to specify column definitions, but again no luck. Since this deals with code residing on a corporate I can't post a link to an example (because access from outside the corporate domain is rejected). We are running on a Linux system using an Apache web server. My browser is IE8 running on a Windows 7 laptop.
Here is the javascript init code written out by my perl script
print qq~
\$(document).ready(function(){
\$('#devices_table').dataTable({
"aaSorting" : [[0,"asc"]] ,
"sPaginationType" : "full_numbers" ,
"bAutoWidth" : treu ,
"iDisplayLength" : 20
});
});
~;
Here is the beginning of my table as written out by my perl script
print qq~
Device NameIP AddressDevice TypeStatusUptime
~;
And here is the end of the table as written out by my perl script
print "\n";
I also have the following CSS code in effect
div.dataTables_wrapper {
background-color: #003366;
color: white;
font-weight: bold;
}
Can anyone help a puzzled datatables rookie ?
Thanks.
Here is the javascript init code written out by my perl script
print qq~
\$(document).ready(function(){
\$('#devices_table').dataTable({
"aaSorting" : [[0,"asc"]] ,
"sPaginationType" : "full_numbers" ,
"bAutoWidth" : treu ,
"iDisplayLength" : 20
});
});
~;
Here is the beginning of my table as written out by my perl script
print qq~
Device NameIP AddressDevice TypeStatusUptime
~;
And here is the end of the table as written out by my perl script
print "\n";
I also have the following CSS code in effect
div.dataTables_wrapper {
background-color: #003366;
color: white;
font-weight: bold;
}
Can anyone help a puzzled datatables rookie ?
Thanks.
This discussion has been closed.
Replies
Perhaps I should have added that I only want the table to be as wide as it "needs to be".