datatables clear table
const table = $("#yourTable").DataTable();
table.clear().draw(); // make sure to call draw() to see the table empty
datatables clear table
const table = $("#yourTable").DataTable();
table.clear().draw(); // make sure to call draw() to see the table empty
clear datatable initialize once data is fetch
if you're using DataTables 1.10.x, you can initialize the new table with
additional option "destroy": true, see below :
function fetchNews(context)
{
if(context!="")
{
$("#dailyNews").dataTable({
"destroy": true,
// ... skipped ...
});
}
}
OR
For older versions :
function fetchNews(context)
{
if(context!="")
{
// Destroy the table
// Use $("#dailyNews").DataTable().destroy() for DataTables 1.10.x
$("#dailyNews").dataTable().fnDestroy()
$("#dailyNews").dataTable({
// ... skipped ...
});
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us