destroy() method not working
destroy() method not working
seiser01
Posts: 17Questions: 9Answers: 0
I'm trying to use the destroy method but it doesn't seem to be working.
[code]alert("creating table")
$(document).ready(function() {
apptDispTable = $('#tbl_appt').dataTable( {
"bDestroy": true
} );
}); // position 1
$(document).ready(function() {
try {
alert("about to destroy") // Position 2
apptDispTable.destroy();
} catch(err) {
DisplayPropertyNames(err) // Position 3
}
});
[/code]
[quote]Note: apptDispTable is a global variable.
1) Output at Position 2 shows my table created with DataTable functionality overlaid with the "about to destroy" alert box
2) Once the alert box is closed, the destroy() method is called which causes an error that is caught.
3) The error is displayed at position 3 and states: "Object doesn't support this property or method"
Why is this happening?
[/quote]
[code]alert("creating table")
$(document).ready(function() {
apptDispTable = $('#tbl_appt').dataTable( {
"bDestroy": true
} );
}); // position 1
$(document).ready(function() {
try {
alert("about to destroy") // Position 2
apptDispTable.destroy();
} catch(err) {
DisplayPropertyNames(err) // Position 3
}
});
[/code]
[quote]Note: apptDispTable is a global variable.
1) Output at Position 2 shows my table created with DataTable functionality overlaid with the "about to destroy" alert box
2) Once the alert box is closed, the destroy() method is called which causes an error that is caught.
3) The error is displayed at position 3 and states: "Object doesn't support this property or method"
Why is this happening?
[/quote]
This discussion has been closed.
Replies
You are using the jQuery object, not the API instance. You should use `DataTable()` - see: http://next.datatables.net/manual/api#Accessing-the-API
Allan