Correctly Suppressing Warnings in DataTables?

I modified the native alert using this closure function to redirect DataTables warnings to the console.

window.alert = (function() {
    var nativeAlert = window.alert;
    return function(message) {
        window.alert = nativeAlert;
        message.indexOf("DataTables warning") === 0 ?
            console.warn(message) :
            nativeAlert(message);
    }
})();

It restores the window.alert to its native function on first trigger. If you don’t want it to restore to the original alert, just comment out the window.alert = nativeAlert; line.

Leave a Comment

techhipbettruvabetnorabahisbahis forumueduseduseduedusedusedusedueduseduedu