Skip to content

Instantly share code, notes, and snippets.

@KeenthemesHub
Created July 27, 2020 01:48
Show Gist options
  • Save KeenthemesHub/938459441beb9b648914ed8deaf20364 to your computer and use it in GitHub Desktop.
Save KeenthemesHub/938459441beb9b648914ed8deaf20364 to your computer and use it in GitHub Desktop.
/**
* Destroy datatable to original DOM state before datatable was
* initialized
* @returns {jQuery}
*/
destroy: function() {
$(datatable).parent().find('.' + pfx + 'datatable-pager').remove();
var initialDatatable = $(datatable.initialDatatable).addClass(pfx + 'datatable-destroyed').show();
$(datatable).replaceWith(initialDatatable);
datatable = initialDatatable;
$(datatable).trigger(pfx + 'datatable-on-destroy');
Plugin.isInit = false;
// clean up variables
initialDatatable = null;
datatable.dataSet = null;
datatable.originalDataSet = null;
datatable.tableHead = null;
datatable.tableBody = null;
datatable.table = null;
datatable.wrap = null;
datatable.API = {
record: null,
value: null,
params: null,
};
Plugin.ajaxParams = {};
Plugin.pagingObject = {};
Plugin.nodeTr = [];
Plugin.nodeTd = [];
Plugin.nodeCols = [];
Plugin.recentNode = [];
return initialDatatable;
},
@AntonioMembrino
Copy link

it gives me variuos errors. where can i found a tutorial to use this datatable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment