Quantcast
Viewing all articles
Browse latest Browse all 82152

Issue with % width on parent when using sScrollY = "XXXpx"

Hi,

I have this issue where the column headings width(s) never changing when I set sScrollY to anything. The actual data within the table scales just fine. This will ONLY occur when the parent of the datatable is set to be a relative width to say the document (like "<div style="width: 80%;"...") What ends up happening is the data in the table scales fine on resize to be relative to the parent but the column headings never change from the size they were at when the datatable was initialized.

In order to reproduce this issue you an simply use the datatables example of sScrollY (located here http://datatables.net/examples/basic_init/scroll_y.html)
and change one thing in the HTML *BEFORE* you open the page (not after in firebug or similar):

find this line:
<div id="container">

and change to:
<div id="container" style="width: 80%;">

Now resize your screen (which resizes the table) and this should effectively reproduce the issue. I have looked at the DOM and it appears DataTables creates some extra wrapper elements that hard-code the width of the headers to be whatever it was when the table was initialized when sScrollY is set (sort of odd right because we didn't set sScrollX?).

If I remove those hardcoded widths everything appears to work perfectly but perhaps they are there for pagination or something else, but since I have it disabled it doesn't matter to me.

Other than this I'm loving Datatables, thanks for developing it!

John

Viewing all articles
Browse latest Browse all 82152

Trending Articles