JS error in fnDestroy() using DataTables 1.10.0-dev: Object not a function

JS error in fnDestroy() using DataTables 1.10.0-dev: Object not a function

madannermadanner Posts: 5Questions: 0Answers: 0
edited December 2013 in General
Hello,

I am using the nightly branch for 1.10.0 since it fixes several column header alignment issues. I am having a problem when I need to destroy a table and recreate it with new columns.

The fnDestroy() method is throwing an exception when executing the "jqaTable(thead)' statement (line 8438) inside the internal destroy method:
[code]...
// When scrolling we had to break the table up - restore it
if ( table != thead.parentNode ) {
jqTable.children('thead').remove();
jqTable( thead );
}
...[/code]

I am fairly new to JS so perhaps this is something I'm just not doing, but my example is pretty simple.
Pressing the reset button calls fnDestroy and throws the exception.
http://jsfiddle.net/gFyc7/1/

The jqTable object is valid before execution. After execution: "Uncaught TypeError: object is not a function"

Seems weird that I'm the only one with this problem, so maybe it's something I'm doing?
Thanks for any help available.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Thanks for spotting that and even more so for the clear and bullet proof example! The error was occurring when the table was scrolling

    I've just committed the required fix and the example you put up is now working :-)

    Regards,
    Allan
  • madannermadanner Posts: 5Questions: 0Answers: 0
    Allan, that’s fantastic. Thanks!

    I only have those pesky scrollbar issues to resolve… You can see the behavior in the same link above…
    The Y scrollbar is always present and scrolls just because the horizontal scroll takes up a small amount of space.

    Likewise, the horizontal scrollbar shows up just because the vertical scrollbar is present.
    Chicken before the egg… I can’t figure out which problem is causing which.

    Any wisdom on what settings need to be in place to fix this? A full screen refresh of the example shows the obvious problem… neither scroll needs to be present but both are, and just to compensate for the scroll widths.
  • madannermadanner Posts: 5Questions: 0Answers: 0
    After another 100 trial and error runs... I believe this appears to be a style issue in dataTables.bootstrap.css.

    Adding this into my style overrides:
    [code]div.dataTables_scrollBody table,
    div.DTFC_LeftBodyWrapper table
    {
    margin-top: 0 !important;
    }[/code]

    seems to fix the problem even when using FixedColumn.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Nice one! Thanks for picking up on that. I'll check it out tomorrow and commit the fix to the repo.

    Allan
This discussion has been closed.