Scroll y and Tabs with IE8 Bug

Scroll y and Tabs with IE8 Bug

Kode3Kode3 Posts: 5Questions: 0Answers: 0
edited August 2010 in Bug reports
I am having an issue with using Scroll y at the same time as using UI tabs with IE8.

I verified the problem exists with this example:

http://www.datatables.net/examples/api/tabs_and_scrolling.html

Specifically the problem is at line 5191 of the non-minified jquery.dataTables.js. The function affected is:

[code]
function _fnScrollingWidthAdjust ( oSettings, n )
{
if ( oSettings.oScroll.sX === "" && oSettings.oScroll.sY !== "" )
{
/* When y-scrolling only, we want to remove the width of the scroll bar so the table
* + scroll bar will fit into the area avaialble.
*/
var iOrigWidth = $(n).width();
n.style.width = _fnStringToCss( $(n).outerWidth()-oSettings.oScroll.iBarWidth );
}
else if ( oSettings.oScroll.sX !== "" )
{
/* When x-scrolling both ways, fix the table at it's current size, without adjusting */
n.style.width = _fnStringToCss( $(n).outerWidth() );
}
}
[/code]

The error from IE8 is:

[code]
Webpage error details

Message: Invalid argument.
Line: 5191
Char: 5
Code: 0
URI: http://www.datatables.net/release-datatables/media/js/jquery.dataTables.js
[/code]


I hope this is enough information to trace this out. I know that it works fine on FF 3.6.8 and the latest Chrome.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Good spotting - thank you for the bug report information! The issue is that DataTables is trying to set a negative width on an element (since it's 0 - something) which IE is objecting to. The fix is to catch this in the _fnStringToCss() function - the block which says "if ( typeof s == 'number' )" should be:

    [code]
    if ( typeof s == 'number' )
    {
    if ( s < 0 )
    {
    return "0px";
    }
    return s+"px";
    }
    [/code]
    Regards,
    Allan
This discussion has been closed.