The fnSettings() method was removed in newer versions of DataTables, and the correct way to access settings now is through table.settings(). However, based on your error message, you might also be using other outdated methods that need to be updated.
Steps to Fix the Issue:
1 - Update fnSettings() to table.settings().
2 - Check for Other Deprecated Methods
Some older DataTables methods have been replaced with newer equivalents:
fnDraw()→draw()fnDestroy()→destroy()fnFilter()→search()fnGetNodes()→rows().nodes()fnClearTable()→clear().draw()
3 - Modify fnDrawCallback
If your fnDrawCallback is still using outdated methods, update it:
$('#example').DataTable({
drawCallback: function () {
var api = this.api();
console.log(api.settings()); // New way to get settings
}
});
4 - Ensure You Have the Latest Compatible DataTables Plugins
If you're using additional DataTables plugins (like Buttons, Responsive, Select, etc.), they also need to match your updated DataTables version. Run:
npm list datatables.net
and update any mismatched dependencies.
Lastly, don't hesitate to read the offical documentation: https://datatables.net/upgrade/2#Legacy-API