When I load my page in first place there nothing in the table and the datatable is not initializated, after a few interactions rows are added and when all rows are added (with ajax calls) I init the datatable this way:
oTable = $('#table).dataTable( {
"bJQueryUI": true,
"bSortClasses": false,
"sDom":'T<"clear">',
"sPaginationType": "full_numbers",
"sDom": 'T<"clear"><"fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"lfr>t<"fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"ip>'
} );
The problem is I want to be able to clear that table and keep on adding stuff in the html and then reInit the table from that source code without using fnAddData.
Any ideas?
Thank you!
function destroy( [ remove ] ) When set to true , as of v1. 10.8, DataTables will use the jQuery . remove() method to remove the table from the page - this results in any events that are bound to the table elements being automatically removed by jQuery.
isDataTable() method provides the ability to check if a table node is already a DataTable or not. It can be accessed at any time, even before any DataTable has been created on the page. isDataTable() is a function of $. fn.
1) fnDestroy does a number of things to return the table to its pre-datatables state. In at least one use here, we want to destroy the table entirely, and are calling fnDestroy to make sure its data is freed.
Calling $('#table').dataTable().fnDestroy();
will clear the table of dataTable
code and allow you to manipulate the table, and then call dataTable
on it again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With