From 258e14a76adba239109befd3d952a036d694f3c8 Mon Sep 17 00:00:00 2001 From: manusfreedom Date: Thu, 16 Nov 2023 14:24:29 +0100 Subject: [PATCH] Add dynamic defaults Useful for retrieving default values from Ajax or for defining certain parameters using a function) : ```js $.fn.dataTable.defaults = function(){ myDefault = $.extend({}, $.fn.dataTable.defaults, { "serverSide": true }); myDefault.stateSave = getFromAjax($(this).attr("id"), "stateSave"); return myDefault; } ``` --- js/core/core.constructor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/core/core.constructor.js b/js/core/core.constructor.js index bec7f0b67..83763c7a9 100644 --- a/js/core/core.constructor.js +++ b/js/core/core.constructor.js @@ -2,7 +2,7 @@ var i=0, iLen, j, jLen, k, kLen; var sId = this.getAttribute( 'id' ); var bInitHandedOff = false; -var defaults = DataTable.defaults; +var defaults = typeof DataTable.defaultsFunction === 'function' ? DataTable.defaultsFunction.call(this) : DataTable.defaults; var $this = $(this);