# HG changeset patch # User Thierry Florac # Date 1413290341 -7200 # Node ID aba8d4e80ea90625dc40e3ab9c5157c07b4f56b4 # Parent 1b31fa7e2ca3a0d6fa4050e173ab23677cf56e6c Added DataTables finalization callback diff -r 1b31fa7e2ca3 -r aba8d4e80ea9 src/ztfy/myams/resources/js/myams.js --- a/src/ztfy/myams/resources/js/myams.js Tue Oct 14 14:35:34 2014 +0200 +++ b/src/ztfy/myams/resources/js/myams.js Tue Oct 14 14:39:01 2014 +0200 @@ -341,7 +341,7 @@ * Copyright Andrew Davy: https://forrst.com/posts/Get_the_URL_of_the_current_javascript_file-Dst */ MyAMS.baseURL = (function () { - var script = $("script:last"); + var script = $('script[src$="/myams.js"], script[src$="/myams.min.js"]'); var src = script.attr("src"); return src.substring(0, src.lastIndexOf('/') + 1); })(); @@ -1721,7 +1721,7 @@ if (callback) { var called = ams.getFunctionByName(callback); if (typeof(called) == 'function') - called(element); + called.apply(source); if (plugin.register !== false) ams.plugins.enabled[name] = called; } else { @@ -2455,6 +2455,12 @@ } } } + var finalizers = (data.amsDatatableFinalizeCallback || '').split(/\s+/); + if (finalizers.length > 0) { + for (index in finalizers) { + ams.executeFunctionByName(finalizers[index], table, plugin, settings); + } + } }); }); }