ColReorder error handling has a bug

ColReorder error handling has a bug

Ironwil616Ironwil616 Posts: 50Questions: 0Answers: 0
edited September 2011 in Bug reports
I am referencing the non-minified file (though the bug of course exists in both) so that I can give human-readable examples. In the _fnOrderColumns function, on lines 478-483, this error handler causes an error:

[code]
if ( a.length != this.s.dt.aoColumns.length )
{
this.s.dt.oInstance.oApi._fnLog( oDTSettings, 1, "ColReorder - array reorder does not "+
"match known number of columns. Skipping." );
return;
}
[/code]

I didn't realize that the columns I passed in had to include all possible column indexes, but that wasn't the initial problem. I kept getting an error stating "'oDTSettings' is undefined". It turned out that in the error handler shown above, oDTSettings was, in fact, undefined when the handler runs. I swapped it out with:

[code]
if ( a.length != this.s.dt.aoColumns.length )
{
alert("ColReorder - array reorder does not "+
"match known number of columns. Reordered Columns: " +
a.length + " Total Columns: " + this.s.dt.aoColumns.length );
return;
}
[/code]

And the error went away, and I was able to see where I went wrong.
This discussion has been closed.