Error calling fnDestroy

Error calling fnDestroy

MV10MV10 Posts: 12Questions: 2Answers: 0
edited April 2014 in General
I get this error trying to call fnDestroy on the table: Object doesn't support property or method 'fnDestroy'

The page is simple: a couple of text inputs and a Search button, followed by an empty container div called "grid" which does double-duty as a general message area and as home to the DataTables grid. When the search is executed, a title-area div, an export button, and a a table called "summary" is created inside the grid div on the fly immediately before the .dataTable call is made. I'm using data stored in a JS array. Everything works fine in the grid -- pagination, row-level buttons created with mData, etc.

Due to oppressive and byzantine corporate rules (it's a banking app) I can't post any actual code or link you to a site, but structurally the end result looks like this:

[code]

Title




[/code]

I mention the structure because I found some older fnDestroy problems in the forum that seemed to be related to surrounding elements.

If the user re-runs the query that populates this table, I try to clean it up like this before executing the new search:

[code]
if($("#summary").length)
$("#summary").fnDestroy(true);
[/code]

As far as I can tell, this is consistent with the example in the API documentation for fnDestroy, but this results in the error message: Object doesn't support property or method 'fnDestroy'

This is under IE9 (unfortunately) with jQuery 1.91.

Replies

  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    fnDestory is not a jQuery method - it is a DataTables method. You need to call it on a DataTables object.

    Allan
  • MV10MV10 Posts: 12Questions: 2Answers: 0
    Ah, now I see. Thanks!
This discussion has been closed.