[BUG SOLVE] Bug in last Fixed Header version + its solution: header not hidden/header always visible
[BUG SOLVE] Bug in last Fixed Header version + its solution: header not hidden/header always visible
Vinntec
Posts: 1Questions: 0Answers: 0
Hi,
Tiny bug report, hope this helps somebody (I lost a lot of time with this).
How to reproduce the bug:
- Browser: Mozilla Firefox v22.0
- OS: Ubuntu 12.04
- Context: basic HTML page with the fixed header code provided in http://datatables.net/extras/fixedheader/.
- Document upper tags are called "html" and "body".
What happens: fixed header is always visible, even outside of the table.
Reason stack (most recent call first):
- scroll updates fail.
- oMes.iTableTop is undefined and therefore scroll updates fail.
- oMes.iTableTop is undefined because fnSumScroll returns an undefined value. This function's inputs are defined.
- The loop in this function does not break correctly.
Solution: fix the function "fnSumScroll" (FixedHeader.js:369).
Old code:
[code]
_fnSumScroll: function ( n, side )
{
var i = n[side];
while ( n = n.parentNode )
{
if ( n.nodeName == 'HTML' || n.nodeName == 'BODY')
{
break;
}
i = n[side];
}
return i;
}
[/code]
Correct code (an option, other possibilities are probable):
[code]
_fnSumScroll: function ( n, side )
{
var i = n[side];
while ( n = n.parentNode )
{
if ( n.nodeName == 'HTML' || n.nodeName == 'BODY' || n.nodeName == 'body' || n.nodeName == 'html' )
{
break;
}
i = n[side];
}
return i;
}
[/code]
The solution fixes the problem in my case.
Cheers,
Vinntec
Tiny bug report, hope this helps somebody (I lost a lot of time with this).
How to reproduce the bug:
- Browser: Mozilla Firefox v22.0
- OS: Ubuntu 12.04
- Context: basic HTML page with the fixed header code provided in http://datatables.net/extras/fixedheader/.
- Document upper tags are called "html" and "body".
What happens: fixed header is always visible, even outside of the table.
Reason stack (most recent call first):
- scroll updates fail.
- oMes.iTableTop is undefined and therefore scroll updates fail.
- oMes.iTableTop is undefined because fnSumScroll returns an undefined value. This function's inputs are defined.
- The loop in this function does not break correctly.
Solution: fix the function "fnSumScroll" (FixedHeader.js:369).
Old code:
[code]
_fnSumScroll: function ( n, side )
{
var i = n[side];
while ( n = n.parentNode )
{
if ( n.nodeName == 'HTML' || n.nodeName == 'BODY')
{
break;
}
i = n[side];
}
return i;
}
[/code]
Correct code (an option, other possibilities are probable):
[code]
_fnSumScroll: function ( n, side )
{
var i = n[side];
while ( n = n.parentNode )
{
if ( n.nodeName == 'HTML' || n.nodeName == 'BODY' || n.nodeName == 'body' || n.nodeName == 'html' )
{
break;
}
i = n[side];
}
return i;
}
[/code]
The solution fixes the problem in my case.
Cheers,
Vinntec
This discussion has been closed.