SCRIPT87: Invalid argument. error with FixedColumns and IE7/8
SCRIPT87: Invalid argument. error with FixedColumns and IE7/8
greenflash
Posts: 58Questions: 5Answers: 0
I get the error
SCRIPT87: Invalid argument. at FixedColumns.min.js, line 29 character 123
when I use FixedColumns with IE7 and IE8. Looking at the FixedColumns code it occurs at the line
[code]oGrid.dt.style.width = iRemainder+"px";[/code]
and the error occurs because iRemainder is negative, which in turn is because iTotal is zero. Furthermore I get lots of these errors.
I think part of the problem is that as far as I can work out $(window).resize is triggered in IE7/8 not just when the window is resized but also when an element in the window is resized.
This does not happen on the example pages, so obviously there's something different about my table/CSS that's provoking the problem. Any ideas on how to change the CSS to circumvent the problem or else patch FixedColumns so the problem doesn't happen much appreciated.
Campbell
SCRIPT87: Invalid argument. at FixedColumns.min.js, line 29 character 123
when I use FixedColumns with IE7 and IE8. Looking at the FixedColumns code it occurs at the line
[code]oGrid.dt.style.width = iRemainder+"px";[/code]
and the error occurs because iRemainder is negative, which in turn is because iTotal is zero. Furthermore I get lots of these errors.
I think part of the problem is that as far as I can work out $(window).resize is triggered in IE7/8 not just when the window is resized but also when an element in the window is resized.
This does not happen on the example pages, so obviously there's something different about my table/CSS that's provoking the problem. Any ideas on how to change the CSS to circumvent the problem or else patch FixedColumns so the problem doesn't happen much appreciated.
Campbell
This discussion has been closed.
Replies
[code]
var winWidth = $(window).width();
var winHeight = $(window).height();
var windowResizeHandler = function() {
// Chck whether it's a genuine window resize (IE7/8 also trigger a
// resize when an element in the window is resized)
var winNewWidth = $(window).width();
var winNewHeight = $(window).height();
if ((winNewWidth == winWidth) && (winNewHeight == winHeight))
{
return;
}
winWidth = winNewWidth;
winHeight = winNewHeight;
// Stop any more resize events while we're dealing with this one
$(window).unbind('resize', windowResizeHandler);
that._fnGridLayout.call( that );
$(window).bind('resize', windowResizeHandler);
};
$(window).bind('resize', windowResizeHandler);
[/code]
Campbell
[code]
if (iTotal == 0)
{
return;
}
[/code]
just after
[code]
var iTotal = $(oGrid.wrapper).width();
[/code]
I'm sure this isn't the best way of dealing with the problem ...
Campbell
I came to the same solution as greenflash before I saw this post
For the record...
This bug for me was triggered because I have multiple tables - each in a jQuery UI tab ... on tab switching the resize event that fires _fnGridLayout() was being called on the table that was not going to be showing.
Some chain of events causes fnSetFilter to result in a call to fnScrollDraw, during which I get the error on line 3338:
// Apply all widths in final pass. Invalidates layout only once because we do not
// read any DOM properties.
_fnApplyToChildren( function(nToSize, i) {
nToSize.style.width = aApplied[i];
}, anHeadToSize );
so I fixed it by assign the width value again.
For example,
in your javascript script to create the fixcolumn object
o=new FixedColumns(...);
add the following statement to assign the width again
$(o.dom.grid.wrapper).width($(o.dom.grid.wrapper).width());
Allan