Relative Widths on Columns when sScrollY is set

Relative Widths on Columns when sScrollY is set

dogmacdogmac Posts: 2Questions: 0Answers: 0
edited March 2013 in General
Hi, I'm new, but have had a big hunt around, and got the answer to most of my problems but not quite all.

I have a table with relative formatting.

My call is currently

[code]
$("#products").dataTable({
"bJQueryUI": true,
"bPaginate": false,
"bScrollCollapse": true,
"aoColumnDefs": [
{ "sWidth": "10%", "aTargets": [ 0, 1, 3,4,5,6,7 ] } // 8 columns, by default column 2 is 30%
],
"bAutoWidth": false,
"sScrollY": "400px"
});
[/code]

Now, this is working fine on most of the table when I resize - the main body resizes correctly with percentages. However, the header row doesn't. If i remove the sScrollY component, it all resizes correctly. As soon as I put it back in, however, the table splits into two tables (dataTables_scrollHead and dataTables_scrollBody), and the header sets actual pixel widths, ignoring the bAutoWidth false. This happens whether I use aoColumns, aoColumnDef or in the table cell widths.

None of the previous questions I've read have mentioned this, though it has been noted that by removing sScrollY resizing works. I was wondering if anyone had a solution.

Thanks so much

Dianne

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    This has been fixed in git - if you add `width="100%"` to your HTML table in the attribute list, but for now, with the current release what you need to do is call the fnAdjustColumnSizing API method on the resize event. That will bring the columns back into sync. I'd suggest you use `bAutoWidth: true` - but it isn't essential I think.

    Allan
  • dogmacdogmac Posts: 2Questions: 0Answers: 0
    Thanks Allan.
This discussion has been closed.