column header size

column header size

mbroadstmbroadst Posts: 14Questions: 0Answers: 0
edited October 2012 in DataTables 1.9
Tried this out in the bugs section to no avail, hope this is the right place.

I have a problem where column headers are not being resized appropriately. The more I look at it, there doesn't seem to be a hard and fast rule for what exactly is screwing up the formatting. Attached is an image displaying what's going on. The table itself has many columns of various length, and I am using the current configuration:

[code]
oTable = $('#terminal_table').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sScrollX": '100%',
"sAjaxSource": "{{=URL('terminal', 'list.json')}}",
"bJQueryUI": true,
"bDeferRender": true,
"sPaginationType": "full_numbers",
"bFilter": true,
"aoColumns": [
{"mDataProp":'index', "bVisible":false},
{"mDataProp":'name', "sTitle":'Name'},
{"mDataProp":'description', "sTitle":'Description', "sWidth":'100px'},
{"mDataProp":'location', "sTitle":'Location', "sWidth":'100px'},
{"mDataProp":'ip_address', "sTitle":'IP Address'},
{"mDataProp":'last_contact', "sTitle":'Last Contact'},
{"mDataProp":'last_terminal_message', "sTitle":'Last Terminal Message', "sWidth":'100px'},
{"mDataProp":'model', "sTitle":'Model'},
{"mDataProp":'operating_system', "sTitle":'Operating System'},
{"mDataProp":'disk_image_version', "sTitle":'Disk Image Version'},
{"mDataProp":'manufacturer', "sTitle":'Manufacturer'},
{"mDataProp":'agent_version', "sTitle":'Agent Version'},
{"mDataProp":'hostname', "sTitle":'Hostname'},
{"mDataProp":'mac_address', "sTitle":'MAC Address'},
{"mDataProp":'serial', "sTitle":'Serial'},
{"mDataProp":'uuid', "sTitle":'UUID'}

]
} );
[/code]


As you can see, I'm explicitly setting the size of some of the columns because otherwise they stretch quite large, even when the whole column is empty. What I am looking for is the table headers to stretch to the right, all resized according to column content AND header length. Each header item should not be wrapped, as well as table items. Everything should fit on a single line since we have already decided to use the scroll area.

Again, no idea whats going on here so I hope someone can help.
Here is the image: http://tinypic.com/r/xg9nvp/7

Thanks,
Matt

Replies

  • bluebaronbluebaron Posts: 33Questions: 0Answers: 0
    Having the same issue.
  • diachundiachun Posts: 1Questions: 0Answers: 0
    Having the same issue too. When column are too large, headers are not resized so I got a table with columns larger as headers
  • mbroadstmbroadst Posts: 14Questions: 0Answers: 0
    still having this issue about a year later. We initially fixed this problem by adding a: "sScrollX": "400%", to the table definition but this leads to the entire table/header expanding way out beyond the table bounds and then resizing into the table, a VERY noticeable operation. Has anyone come up with a solution to this? Is there something I'm not thinking of?
This discussion has been closed.