diff --git a/api/processing().js b/api/processing().js
index 4006fc6..84164aa 100644
--- a/api/processing().js
+++ b/api/processing().js
@@ -1,5 +1,8 @@
/**
- * Externally trigger the display of DataTables' "processing" indicator.
+ * Externally trigger the display of DataTables' "processing" indicator.
+ *
+ * Please note that of DataTables 2.0.0 this functionality is now built into
+ * DataTables core and this plug-in is no longer required.
*
* @name processing()
* @summary Show / hide the processing indicator via the API
diff --git a/api/rows().generate().js b/api/rows().generate().js
new file mode 100644
index 0000000..ba4475f
--- /dev/null
+++ b/api/rows().generate().js
@@ -0,0 +1,22 @@
+/**
+ * When using `-init deferRender` you might find that under a specific set of circumstances you
+ * need the `-tag tr` element for a row which hasn't yet been drawn. This method can be used to
+ * create the nodes for the rows which haven't yet been drawn.
+ *
+ * @name rows().generate()
+ * @summary Create tr elements for rows which have not yet had their nodes created.
+ * @author [Allan Jardine](http://datatables.net)
+ * @requires DataTables 1.10+
+ *
+ * @returns {DataTable.Api} DataTables API instance
+ *
+ * @example
+ * // Create nodes for all rows
+ * table.rows().generate();
+ */
+
+ $.fn.dataTable.Api.register( 'rows().generate()', function () {
+ return this.iterator( 'row', function ( context, index ) {
+ context.oApi._fnCreateTr( context, index );
+ } );
+} );
\ No newline at end of file
diff --git a/buttons/button.download.js b/buttons/button.download.js
new file mode 100644
index 0000000..36de995
--- /dev/null
+++ b/buttons/button.download.js
@@ -0,0 +1,113 @@
+/*! Download button for Buttons
+ * 2018 SpryMedia Ltd - MIT licensed - datatables.net/license
+ */
+
+/**
+ * @summary Download Button
+ * @author SpryMedia Ltd (www.datatables.net)
+ * @copyright Copyright 2018 SpryMedia Ltd.
+ *
+ * License MIT - http://datatables.net/license/mit
+ *
+ * A button that can be used to trigger a server-side action, typically a
+ * download of a file generated by the server. If server-side processing
+ * is enabled in the host table it will automatically add the last parameters
+ * used for a table draw allowing the script to output a file with the same
+ * order / search applied as the main table.
+ *
+ * This is particularly useful when using server-side processing and wishing
+ * to allow user export of the data in a table. The default Buttons package
+ * will only export the data available on the client-side, while this button
+ * can be used to let the server generate the required file and then download
+ * it to the client-side.
+ *
+ * @example
+ * // Download button
+ * var table = $('#example').DataTable({
+ * dom: 'Bfrtip',
+ * buttons: [
+ * {
+ * extend: 'download',
+ * url: '/api/download'
+ * }
+ * ]
+ * });
+ */
+(function(window, document, $, undefined) {
+ function flattenJson(data, name, flattened) {
+ if (!flattened) {
+ flattened = {};
+ }
+
+ if (!name) {
+ name = '';
+ }
+
+ if ($.isPlainObject(data) || $.isArray(data)) {
+ $.each(data, function(idx, val) {
+ if (name === '') {
+ flattenJson(val, idx, flattened);
+ } else {
+ flattenJson(val, name + '[' + idx + ']', flattened);
+ }
+ });
+ } else {
+ flattened[name] = data;
+ }
+
+ return flattened;
+ }
+
+ $.fn.dataTable.ext.buttons.download = {
+ text: 'Download',
+ action: function(e, dt, node, config) {
+ // Gather information to be submitted
+ var data = {};
+
+ if (dt.page.info().serverSide) {
+ $.extend(data, dt.ajax.params());
+ }
+
+ if (typeof config.data === 'function') {
+ config.data(data);
+ } else if (typeof config.data === 'object') {
+ $.extend(data, config.data);
+ }
+
+ // Convert data to a flat structure for submission
+ var flattened = flattenJson(data);
+
+ // Create an iframe
+ var iframe = $('')
+ .css({
+ border: 'none',
+ height: 0,
+ width: 0
+ })
+ .appendTo(document.body);
+
+ var contentDoc = iframe[0].contentWindow.document;
+ contentDoc.open();
+ contentDoc.close();
+
+ var form = $('
', contentDoc)
+ .attr('method', config.type)
+ .attr('action', config.url)
+ .appendTo(contentDoc.body);
+
+ $.each(flattened, function(name, val) {
+ $('', contentDoc)
+ .attr('type', 'text')
+ .attr('name', name)
+ .attr('autocomplete', 'no')
+ .val(val)
+ .appendTo(form);
+ });
+
+ form.submit();
+ },
+ url: '',
+ type: 'POST',
+ data: {}
+ };
+})(window, document, jQuery);
diff --git a/dataRender/datetime.js b/dataRender/datetime.js
index d56a195..9c11a20 100644
--- a/dataRender/datetime.js
+++ b/dataRender/datetime.js
@@ -14,9 +14,9 @@
*
* It accepts one, two or three parameters:
*
- * $.fn.dataTable.render.moment( to );
- * $.fn.dataTable.render.moment( from, to );
- * $.fn.dataTable.render.moment( from, to, locale );
+ * * `$.fn.dataTable.render.moment( to );`
+ * * `$.fn.dataTable.render.moment( from, to );`
+ * * `$.fn.dataTable.render.moment( from, to, locale );`
*
* Where:
*
@@ -29,7 +29,7 @@
* @name datetime
* @summary Convert date / time source data into one suitable for display
* @author [Allan Jardine](http://datatables.net)
- * @requires DataTables 1.10+
+ * @requires DataTables 1.10+, Moment.js 1.7+
*
* @example
* // Convert ISO8601 dates into a simple human readable format
diff --git a/features/alphabetSearch/dataTables.alphabetSearch.min.js b/features/alphabetSearch/dataTables.alphabetSearch.min.js
index fc108e1..033b500 100644
--- a/features/alphabetSearch/dataTables.alphabetSearch.min.js
+++ b/features/alphabetSearch/dataTables.alphabetSearch.min.js
@@ -1,17 +1,8 @@
/*!
- Copyright 2014 SpryMedia Ltd.
-
- License MIT - http://datatables.net/license/mit
-
- For more detailed information please see:
- http://datatables.net/blog/2014-09-22
AlphabetSearch for DataTables v1.0.0
2014 SpryMedia Ltd - datatables.net/license
*/
-var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,d,b){a instanceof String&&(a=String(a));for(var c=a.length,e=0;e/g,"").charAt(0).toUpperCase();a[f]?a[f]++:a[f]=1}$('').data("letter","").data("match-count",c.length).html("None").appendTo(b);for(c=0;26>c;c++)f=String.fromCharCode(65+c),$("").data("letter",f).data("match-count",a[f]||0).addClass(a[f]?"":"empty").html(f).appendTo(b);$('').appendTo(b)}
-$.fn.dataTable.Api.register("alphabetSearch()",function(a){this.iterator("table",function(b){b.alphabetSearch=a});return this});$.fn.dataTable.Api.register("alphabetSearch.recalc()",function(d){this.iterator("table",function(b){a(new $.fn.dataTable.Api(b),$("div.alphabet",this.table().container()))});return this});$.fn.dataTable.ext.search.push(function(a,b){return a.alphabetSearch&&b[0].charAt(0)!==a.alphabetSearch?!1:!0});$.fn.dataTable.AlphabetSearch=function(d){var b=new $.fn.dataTable.Api(d),
-c=$('');a(b,c);c.on("click","span",function(){c.find(".active").removeClass("active");$(this).addClass("active");b.alphabetSearch($(this).data("letter")).draw()});c.on("mouseenter","span",function(){c.find("div.alphabetInfo").css({opacity:1,left:$(this).position().left,width:$(this).width()}).html($(this).data("match-count"))}).on("mouseleave","span",function(){c.find("div.alphabetInfo").css("opacity",0)});this.node=function(){return c}};$.fn.DataTable.AlphabetSearch=$.fn.dataTable.AlphabetSearch;
-$.fn.dataTable.ext.feature.push({fnInit:function(a){return(new $.fn.dataTable.AlphabetSearch(a)).node()},cFeature:"A"})})();
+(function(){function f(b,c){c.empty();c.append("Search: ");for(var a=b.column(0).data(),d,e={},g=0,f=a.length;g/g,"").charAt(0).toUpperCase(),e[d]?e[d]++:e[d]=1;$('').data("letter","").data("match-count",a.length).html("None").appendTo(c);for(a=0;26>a;a++)d=String.fromCharCode(65+a),$("").data("letter",d).data("match-count",e[d]||0).addClass(!e[d]?"empty":"").html(d).appendTo(c);$('').appendTo(c)}
+$.fn.dataTable.Api.register("alphabetSearch()",function(b){this.iterator("table",function(c){c.alphabetSearch=b});return this});$.fn.dataTable.Api.register("alphabetSearch.recalc()",function(){this.iterator("table",function(b){f(new $.fn.dataTable.Api(b),$("div.alphabet",this.table().container()))});return this});$.fn.dataTable.ext.search.push(function(b,c){return!b.alphabetSearch||c[0].charAt(0)===b.alphabetSearch?!0:!1});$.fn.dataTable.AlphabetSearch=function(b){var c=new $.fn.dataTable.Api(b),
+a=$('');f(c,a);a.on("click","span",function(){a.find(".active").removeClass("active");$(this).addClass("active");c.alphabetSearch($(this).data("letter")).draw()});a.on("mouseenter","span",function(){a.find("div.alphabetInfo").css({opacity:1,left:$(this).position().left,width:$(this).width()}).html($(this).data("match-count"))}).on("mouseleave","span",function(){a.find("div.alphabetInfo").css("opacity",0)});this.node=function(){return a}};$.fn.DataTable.AlphabetSearch=$.fn.dataTable.AlphabetSearch;
+$.fn.dataTable.ext.feature.push({fnInit:function(b){return(new $.fn.dataTable.AlphabetSearch(b)).node()},cFeature:"A"})})();
diff --git a/features/conditionalPaging/dataTables.conditionalPaging.js b/features/conditionalPaging/dataTables.conditionalPaging.js
index 7326351..4fb7fae 100644
--- a/features/conditionalPaging/dataTables.conditionalPaging.js
+++ b/features/conditionalPaging/dataTables.conditionalPaging.js
@@ -70,7 +70,7 @@
}
};
- if ($.isNumeric(config.speed) || $.type(config.speed) === 'string') {
+ if ( config.speed !== undefined ) {
speed = config.speed;
}
diff --git a/features/deepLink/dataTables.deepLink.min.js b/features/deepLink/dataTables.deepLink.min.js
index 2fceafa..b30d1db 100644
--- a/features/deepLink/dataTables.deepLink.min.js
+++ b/features/deepLink/dataTables.deepLink.min.js
@@ -1,42 +1,5 @@
/*!
- Copyright 2017 SpryMedia Ltd.
-
- License MIT - http://datatables.net/license/mit
-
- This feature plug-in for DataTables provides a function which will
- take DataTables options from the browser's URL search string and
- return an object that can be used to construct a DataTable. This
- allows deep linking to be easily implemented with DataTables - for
- example a URL might be `myTable?displayStart=10` which will
- automatically cause the second page of the DataTable to be displayed.
-
- This plug-in works on a whitelist basis - you must specify which
- [initialisation parameters](//datatables.net/reference/option) you
- want the URL search string to specify. Any parameter given in the
- URL which is not listed will be ignored (e.g. you are unlikely to
- want to let the URL search string specify the `ajax` option).
-
- This specification is done by passing an array of property names
- to the `$.fn.dataTable.ext.deepLink` function. If you do which to
- allow _every_ parameter (I wouldn't recommend it) you can use `all`
- instead of an array.
-
- @example
- // Allow a display start point and search string to be specified
- $('#myTable').DataTable(
- $.fn.dataTable.ext.deepLink( [ 'displayStart', 'search.search' ] )
- );
-
- @example
- // As above, but with a default search
- var options = $.fn.dataTable.ext.deepLink(['displayStart', 'search.search']);
-
- $('#myTable').DataTable(
- $.extend( true, {
- search: { search: 'Initial search value' }
- }, options )
- );
Deep linking options parsing support for DataTables
2017 SpryMedia Ltd - datatables.net/license
*/
-(function(l,m,b,n){var h=b.fn.dataTable.ext.internal._fnSetObjectDataFn;b.fn.dataTable.ext.deepLink=function(d){for(var e=location.search.replace(/^\?/,"").split("&"),f={},c=0,k=e.length;c").addClass(f.oClasses.sLength),h=null;this.container=function(){return e[0]};e.on("click.dtll","a",function(b){b.preventDefault();c.page.len(1*a(this).data("length")).draw(!1)});c.on("draw",function(){if(c.page.len()!==h){var b=f.aLengthMenu,d=2===b.length&&a.isArray(b[0])?b[1]:b,g=2===b.length&&a.isArray(b[0])?b[0]:b,b=a.map(g,function(b,a){return b==c.page.len()?'").addClass(f.oClasses.sLength),h=null;this.container=function(){return e[0]};e.on("click.dtll","a",function(b){b.preventDefault();c.page.len(1*a(this).data("length")).draw(!1)});c.on("draw",function(){if(c.page.len()!==h){var b=f.aLengthMenu,d=2===b.length&&a.isArray(b[0])?b[1]:b,g=2===b.length&&a.isArray(b[0])?b[0]:b,b=a.map(g,function(b,a){return b==c.page.len()?''+d[a]+"":''+d[a]+""});e.html(f.oLanguage.sLengthMenu.replace("_MENU_",b.join(" | ")));h=c.page.len()}});c.on("destroy",function(){e.off("click.dtll","a")})};a.fn.dataTable.ext.feature.push({fnInit:function(d){return(new a.fn.dataTable.LengthLinks(d)).container()},cFeature:"L",sFeature:"LengthLinks"})})(window,document,jQuery);
diff --git a/features/pageResize/dataTables.pageResize.js b/features/pageResize/dataTables.pageResize.js
index 52d3015..a63ee24 100644
--- a/features/pageResize/dataTables.pageResize.js
+++ b/features/pageResize/dataTables.pageResize.js
@@ -34,8 +34,34 @@
* For more detailed information please see:
* http://datatables.net/blog/2015-04-10
*/
+(function( factory ){
+ if ( typeof define === 'function' && define.amd ) {
+ // AMD
+ define( ['jquery', 'datatables.net'], function ( $ ) {
+ return factory( $, window, document );
+ } );
+ }
+ else if ( typeof exports === 'object' ) {
+ // CommonJS
+ module.exports = function (root, $) {
+ if ( ! root ) {
+ root = window;
+ }
+
+ if ( ! $ || ! $.fn.dataTable ) {
+ $ = require('datatables.net')(root, $).$;
+ }
+
+ return factory( $, root, root.document );
+ };
+ }
+ else {
+ // Browser
+ factory( jQuery, window, document );
+ }
+}(function( $, window, document, undefined ) {
+'use strict';
-(function($){
var PageResize = function ( dt, pageResizeManualDelta )
{
@@ -69,7 +95,8 @@ PageResize.prototype = {
var dt = settings.dt;
var t = dt.table();
var offsetTop = $( settings.table ).offset().top;
- var rowHeight = $( 'tr', settings.body ).eq(0).height();
+ var rows = $( 'tr', settings.body );
+ var rowHeight = rows.eq( rows.length > 1 ? 1 : 0 ).height(); // Attempt to use the second row if poss, for top and bottom border
var availableHeight = settings.host.height();
var scrolling = t.header().parentNode !== t.body().parentNode;
var delta = settings.delta;
@@ -159,5 +186,5 @@ $(document).on( 'init.dt', function ( e, settings ) {
}
} );
-}(jQuery));
+}));
diff --git a/features/pageResize/dataTables.pageResize.min.js b/features/pageResize/dataTables.pageResize.min.js
index 29ff760..fd6e382 100644
--- a/features/pageResize/dataTables.pageResize.min.js
+++ b/features/pageResize/dataTables.pageResize.min.js
@@ -1,30 +1,8 @@
/*!
- Copyright 2015 SpryMedia Ltd.
-
- License MIT - http://datatables.net/license/mit
-
- This feature plug-in for DataTables will automatically change the DataTables
- page length in order to fit inside its container. This can be particularly
- useful for control panels and other interfaces which resize dynamically with
- the user's browser window instead of scrolling.
-
- Page resizing in DataTables can be enabled by using any one of the following
- options:
-
- * Adding the class `pageResize` to the HTML table
- * Setting the `pageResize` parameter in the DataTables initialisation to
- be true - i.e. `pageResize: true`
- * Setting the `pageResize` parameter to be true in the DataTables
- defaults (thus causing all tables to have this feature) - i.e.
- `$.fn.dataTable.defaults.pageResize = true`.
- * Creating a new instance: `new $.fn.dataTable.PageResize( table );` where
- `table` is a DataTable's API instance.
-
- For more detailed information please see:
- http://datatables.net/blog/2015-04-10
PageResize for DataTables v1.0.0
2015 SpryMedia Ltd - datatables.net/license
*/
-(function(b){var e=function(a,c){var d=a.table();this.s={dt:a,host:b(d.container()).parent(),header:b(d.header()),footer:b(d.footer()),body:b(d.body()),container:b(d.container()),table:b(d.node()),delta:c};a=this.s.host;"static"===a.css("position")&&a.css("position","relative");this._attach();this._size()};e.prototype={_size:function(){var a=this.s,c=a.dt,d=c.table(),h=b(a.table).offset().top,e=b("tr",a.body).eq(0).height(),f=a.host.height(),k=d.header().parentNode!==d.body().parentNode,g=a.delta;
-k||(d.header()&&(f-=a.header.height()),d.footer()&&(f-=a.footer.height()));f=f-h-(a.container.height()-(h+a.table.height()));!isNaN(parseFloat(g))&&isFinite(g)&&(f-=g);a=Math.floor(f/e);Infinity!==a&&-Infinity!==a&&!isNaN(a)&&0").css({position:"absolute",top:0,left:0,height:"100%",width:"100%",zIndex:-1}).attr("type","text/html");c[0].onload=function(){var b=this.contentDocument.body,c=b.offsetHeight;this.contentDocument.defaultView.onresize=
-function(){var d=b.clientHeight||b.offsetHeight;d!==c&&(c=d,a._size())}};c.appendTo(this.s.host).attr("data","about:blank")}};b.fn.dataTable.PageResize=e;b.fn.DataTable.PageResize=e;b(document).on("init.dt",function(a,c){"dt"===a.namespace&&(a=new b.fn.dataTable.Api(c),(b(a.table().node()).hasClass("pageResize")||c.oInit.pageResize||b.fn.dataTable.defaults.pageResize)&&new e(a,c.oInit.pageResizeManualDelta))})})(jQuery);
+(function(b){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return b(e,window,document)}):"object"===typeof exports?module.exports=function(e,c){e||(e=window);if(!c||!c.fn.dataTable)c=require("datatables.net")(e,c).$;return b(c,e,e.document)}:b(jQuery,window,document)})(function(b,e,c){var g=function(a,h){var d=a.table();this.s={dt:a,host:b(d.container()).parent(),header:b(d.header()),footer:b(d.footer()),body:b(d.body()),container:b(d.container()),table:b(d.node()),
+delta:h};d=this.s.host;"static"===d.css("position")&&d.css("position","relative");this._attach();this._size()};g.prototype={_size:function(){var a=this.s,h=a.dt,d=h.table(),e=b(a.table).offset().top,c=b("tr",a.body),c=c.eq(1").css({position:"absolute",top:0,left:0,height:"100%",width:"100%",zIndex:-1}).attr("type","text/html");c[0].onload=function(){var d=this.contentDocument.body,b=d.offsetHeight;this.contentDocument.defaultView.onresize=function(){var c=d.clientHeight||d.offsetHeight;c!==b&&(b=c,a._size())}};c.appendTo(this.s.host).attr("data","about:blank")}};b.fn.dataTable.PageResize=
+g;b.fn.DataTable.PageResize=g;b(c).on("init.dt",function(a,c){if("dt"===a.namespace){var d=new b.fn.dataTable.Api(c);(b(d.table().node()).hasClass("pageResize")||c.oInit.pageResize||b.fn.dataTable.defaults.pageResize)&&new g(d,c.oInit.pageResizeManualDelta)}})});
diff --git a/features/pageResize/index.html b/features/pageResize/index.html
index d1cadbe..83ab2ff 100644
--- a/features/pageResize/index.html
+++ b/features/pageResize/index.html
@@ -5,7 +5,7 @@
DataTables page resize example
-
+
-
-
+
+
-
+
+
+
+
+
+
+
+