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/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/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 2653a3d..fd6e382 100644 --- a/features/pageResize/dataTables.pageResize.min.js +++ b/features/pageResize/dataTables.pageResize.min.js @@ -2,6 +2,7 @@ PageResize for DataTables v1.0.0 2015 SpryMedia Ltd - datatables.net/license */ -(function(c){var f=function(a,d){var b=a.table();this.s={dt:a,host:c(b.container()).parent(),header:c(b.header()),footer:c(b.footer()),body:c(b.body()),container:c(b.container()),table:c(b.node()),delta:d};b=this.s.host;"static"===b.css("position")&&b.css("position","relative");this._attach();this._size()};f.prototype={_size:function(){var a=this.s,d=a.dt,b=d.table(),h=c(a.table).offset().top,f=c("tr",a.body).eq(0).height(),e=a.host.height(),i=b.header().parentNode!==b.body().parentNode,g=a.delta; -i||(b.header()&&(e-=a.header.height()),b.footer()&&(e-=a.footer.height()));e=e-h-(a.container.height()-(h+a.table.height()));!isNaN(parseFloat(g))&&isFinite(g)&&(e-=g);a=Math.floor(e/f);Infinity!==a&&(-Infinity!==a&&!isNaN(a)&&0").css({position:"absolute",top:0,left:0,height:"100%",width:"100%",zIndex:-1}).attr("type","text/html");d[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())}};d.appendTo(this.s.host).attr("data","about:blank")}};c.fn.dataTable.PageResize=f;c.fn.DataTable.PageResize=f;c(document).on("init.dt",function(a,d){if("dt"===a.namespace){var b=new c.fn.dataTable.Api(d);(c(b.table().node()).hasClass("pageResize")||d.oInit.pageResize||c.fn.dataTable.defaults.pageResize)&&new f(b,d.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 - + - - + + - + +