DataTables warning: table id= - Ajax error please see



... I've shiny application using datatable and when network disconnected and resumed data table will throw a alert popup dialog in the browser

DataTables warning: table id= {id} - Ajax error

For more information about this error, please see

I googled and read some suggestion and come with following code insert into server code.

tags$script("$(function() {$.fn.dataTableExt.errMode = function(settings, tn, msg) { console.log(msg); }; });"),

tags$script(HTML("$(function() {$.fn.dataTableExt.errMode = function(settings, tn, msg) { console.log(msg); }; });")),
tags$script(HTML("$.fn.dataTable.ext.errMode = 'none';")),

tags$script("$(function() {$.fn.dataTableExt.errMode = function(settings, tn, msg) { console.log(msg); }; });"),
tags$script("$.fn.dataTable.ext.errMode = 'none';"),

but none of above work, still see datatable warning msg anyway.

Can you help me with this? it is very hard to explain what is this error to end user. it becomes critical to resolving it with high impact now.

thank you.



If you provide a reproducible example, that will help others to help you.


I don’t see the suggested workaround from the DataTables documentation you linked among the things you tried. The docs say:

If you are willing to accept the error (for example if you cannot alter the backend system to fix the error), but don't want your end users to see the alert() message, you can change DataTables' error reporting mechanism to throw a Javascript error to the browser's console, rather than alerting it. This can be done using:

$.fn.dataTable.ext.errMode = 'throw';

Did you try that, too?


Thank you!

Yes. I tried that as well. both .fn.dataTable.ext.errMode = 'throw'; and .fn.dataTable.ext.errMode = 'none';

Here are data table docs

But none of them work. Still can see alert windows when network disconnected and resume again from mobile chrome.

I suspect the way I run the script

tags$script(HTML("$.fn.dataTable.ext.errMode = 'none';")),
tags$script(HTML("$.fn.dataTable.ext.errMode = 'throw';")),
tags$script(("$.fn.dataTable.ext.errMode = 'none';")),
tags$script(("$.fn.dataTable.ext.errMode = 'throw';")),

somehow not trigger datatable javascript properly. I dont have deep knowledge about datatable and shiny, dont know what to do now. I ever tried to traced to the original datatable.js file and tried to remove the "alert" line of code but dont know how to merge back to shiny sadly.....