you must use "bDestroy": true .
Replace the DataTable that matches the specified selector, and replace it with those who have the properties of the passed new initialization object. If the table does not match the selector, then a new DataTable will be created as normal.
$(document).ready(function() { $('#ideas').dataTable({ "aLengthMenu": [[5, 10, 15, -1], [5, 10, 50, "All"]], "bDestroy": true }); });
Also try this before creating a new data type that destroys previous data objects.
$(document).ready(function() { $("#ideas").dataTable().fnDestroy(); $('#ideas').dataTable({ "aLengthMenu": [[5, 10, 15, -1], [5, 10, 50, "All"]] }); });
source share