From c3811a16fdc34c2d770accdc1ed67a9b5b85321c Mon Sep 17 00:00:00 2001 From: Gregor Schatz Date: Wed, 13 Feb 2019 18:58:04 +0100 Subject: [PATCH 1/3] Workaround/Fix for table.ajax.reload() with data source "ssd" and ajax object in configuration: In Microsoft IE 11.0.40 and Apple Safari 12.0.3 I get additional DataTable initialisations with data source detected as 'dom' and settings Object containing ajax set to null. It nevertheless tries to build an ajax request and thus and breaks when ajax from settions object comes into use. var table = $("#table").DataTable({ serverSide: true, ajax: { url:"...", method:"...", data: function (){ // ... } } }); $("#table").DataTable().ajax.reload(); --- js/api/api.ajax.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/api/api.ajax.js b/js/api/api.ajax.js index 49aa7be13..99c28da5c 100644 --- a/js/api/api.ajax.js +++ b/js/api/api.ajax.js @@ -1,6 +1,11 @@ var __reload = function ( settings, holdPosition, callback ) { + // Not an ajax source - abort + if ( settings.ajax == null ) { + return; + } + // Use the draw event to trigger a callback if ( callback ) { var api = new _Api( settings ); From 8e9b5829d413419dd31bef56969058976676fdb0 Mon Sep 17 00:00:00 2001 From: Gregor Schatz Date: Wed, 13 Feb 2019 19:32:14 +0100 Subject: [PATCH 2/3] set ajax.data to null before delete --- js/core/core.ajax.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/core/core.ajax.js b/js/core/core.ajax.js index 1ac156cda..1c8205553 100644 --- a/js/core/core.ajax.js +++ b/js/core/core.ajax.js @@ -60,6 +60,7 @@ function _fnBuildAjax( oSettings, data, fn ) // Remove the data property as we've resolved it already and don't want // jQuery to do it again (it is restored at the end of the function) + ajax.data = null; // or undefined - for IE / Safari delete ajax.data; } From d503ca63c61fc984c7b463e354b2231367e70c6d Mon Sep 17 00:00:00 2001 From: Gregor Schatz Date: Wed, 13 Feb 2019 19:52:58 +0100 Subject: [PATCH 3/3] ajax another litte Fix - improving robustness of ajax.data restore --- js/core/core.ajax.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/core/core.ajax.js b/js/core/core.ajax.js index 1c8205553..d08071072 100644 --- a/js/core/core.ajax.js +++ b/js/core/core.ajax.js @@ -129,8 +129,10 @@ function _fnBuildAjax( oSettings, data, fn ) // Object to extend the base settings oSettings.jqXHR = $.ajax( $.extend( baseAjax, ajax ) ); - // Restore for next time around - ajax.data = ajaxData; + if (ajax && ajaxData) { + // Restore for next time around + ajax.data = ajaxData; + } } }