jquery-datatables 1.10.16 → 1.10.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +2 -0
  3. data/app/assets/javascripts/datatables/dataTables.foundation.js +2 -2
  4. data/app/assets/javascripts/datatables/dataTables.uikit.js +1 -1
  5. data/app/assets/javascripts/datatables/extensions/AutoFill/autoFill.dataTables.js +38 -0
  6. data/app/assets/javascripts/datatables/extensions/AutoFill/dataTables.autoFill.js +52 -12
  7. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.colVis.js +4 -8
  8. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.dataTables.js +38 -0
  9. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.flash.js +17 -7
  10. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.html5.js +33 -19
  11. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.print.js +14 -3
  12. data/app/assets/javascripts/datatables/extensions/Buttons/dataTables.buttons.js +120 -53
  13. data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.bootstrap.js +38 -0
  14. data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.bootstrap4.js +38 -0
  15. data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.dataTables.js +38 -0
  16. data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.foundation.js +38 -0
  17. data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.jqueryui.js +38 -0
  18. data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.semanicui.js +38 -0
  19. data/app/assets/javascripts/datatables/extensions/ColReorder/dataTables.colReorder.js +76 -13
  20. data/app/assets/javascripts/datatables/extensions/FixedColumns/dataTables.fixedColumns.js +23 -17
  21. data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.bootstrap.js +38 -0
  22. data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.bootstrap4.js +38 -0
  23. data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.dataTables.js +38 -0
  24. data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.foundation.js +38 -0
  25. data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.jqueryui.js +38 -0
  26. data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.semanicui.js +38 -0
  27. data/app/assets/javascripts/datatables/extensions/FixedHeader/dataTables.fixedHeader.js +26 -11
  28. data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.bootstrap.js +38 -0
  29. data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.bootstrap4.js +38 -0
  30. data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.dataTables.js +38 -0
  31. data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.foundation.js +38 -0
  32. data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.jqueryui.js +38 -0
  33. data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.semanicui.js +38 -0
  34. data/app/assets/javascripts/datatables/extensions/KeyTable/dataTables.keyTable.js +141 -75
  35. data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.bootstrap.js +38 -0
  36. data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.bootstrap4.js +38 -0
  37. data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.dataTables.js +38 -0
  38. data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.foundation.js +38 -0
  39. data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.jqueryui.js +38 -0
  40. data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.semanicui.js +38 -0
  41. data/app/assets/javascripts/datatables/extensions/Responsive/dataTables.responsive.js +64 -26
  42. data/app/assets/javascripts/datatables/extensions/Responsive/responsive.dataTables.js +38 -0
  43. data/app/assets/javascripts/datatables/extensions/RowGroup/dataTables.rowGroup.js +45 -13
  44. data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.bootstrap.js +38 -0
  45. data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.bootstrap4.js +38 -0
  46. data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.dataTables.js +38 -0
  47. data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.foundation.js +38 -0
  48. data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.jqueryui.js +38 -0
  49. data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.semanicui.js +38 -0
  50. data/app/assets/javascripts/datatables/extensions/RowReorder/dataTables.rowReorder.js +24 -6
  51. data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.bootstrap.js +38 -0
  52. data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.bootstrap4.js +38 -0
  53. data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.dataTables.js +38 -0
  54. data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.foundation.js +38 -0
  55. data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.jqueryui.js +38 -0
  56. data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.semanicui.js +38 -0
  57. data/app/assets/javascripts/datatables/extensions/Scroller/dataTables.scroller.js +93 -87
  58. data/app/assets/javascripts/datatables/extensions/Scroller/scroller.bootstrap.js +38 -0
  59. data/app/assets/javascripts/datatables/extensions/Scroller/scroller.bootstrap4.js +38 -0
  60. data/app/assets/javascripts/datatables/extensions/Scroller/scroller.dataTables.js +38 -0
  61. data/app/assets/javascripts/datatables/extensions/Scroller/scroller.foundation.js +38 -0
  62. data/app/assets/javascripts/datatables/extensions/Scroller/scroller.jqueryui.js +38 -0
  63. data/app/assets/javascripts/datatables/extensions/Scroller/scroller.semanticui.js +38 -0
  64. data/app/assets/javascripts/datatables/extensions/Select/dataTables.select.js +41 -14
  65. data/app/assets/javascripts/datatables/extensions/Select/select.bootstrap.js +38 -0
  66. data/app/assets/javascripts/datatables/extensions/Select/select.bootstrap4.js +38 -0
  67. data/app/assets/javascripts/datatables/extensions/Select/select.dataTables.js +38 -0
  68. data/app/assets/javascripts/datatables/extensions/Select/select.foundation.js +38 -0
  69. data/app/assets/javascripts/datatables/extensions/Select/select.jqueryui.js +38 -0
  70. data/app/assets/javascripts/datatables/extensions/Select/select.semanticui.js +38 -0
  71. data/app/assets/javascripts/datatables/jquery.dataTables.js +125 -72
  72. data/app/assets/stylesheets/datatables/dataTables.bootstrap4.scss +4 -0
  73. data/app/assets/stylesheets/datatables/dataTables.foundation.scss +5 -5
  74. data/app/assets/stylesheets/datatables/dataTables.material.scss +1 -1
  75. data/app/assets/stylesheets/datatables/dataTables.uikit.scss +33 -22
  76. data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.bootstrap.scss +9 -0
  77. data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.bootstrap4.scss +9 -0
  78. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.dataTables.scss +3 -2
  79. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.jqueryui.scss +2 -4
  80. data/app/assets/stylesheets/datatables/extensions/Buttons/mixins.scss +5 -0
  81. data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.bootstrap4.scss +3 -6
  82. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.bootstrap.scss +1 -1
  83. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.bootstrap4.scss +1 -1
  84. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.dataTables.scss +6 -5
  85. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.foundation.scss +1 -1
  86. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.semanticui.scss +1 -1
  87. data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.bootstrap.scss +1 -1
  88. data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.bootstrap4.scss +2 -4
  89. data/app/assets/stylesheets/datatables/jquery.dataTables.scss +5 -5
  90. data/jquery-datatables.gemspec +4 -2
  91. data/lib/generators/jquery/datatables/install_generator.rb +22 -6
  92. data/lib/generators/jquery/datatables/templates/{bootstrap.js.tt → javascripts/bootstrap.js.tt} +0 -0
  93. data/lib/generators/jquery/datatables/templates/{bootstrap4.js.tt → javascripts/bootstrap4.js.tt} +0 -0
  94. data/lib/generators/jquery/datatables/templates/{foundation.js.tt → javascripts/foundation.js.tt} +0 -0
  95. data/lib/generators/jquery/datatables/templates/javascripts/initializer.js.tt +30 -0
  96. data/lib/generators/jquery/datatables/templates/{jqueryui.js.tt → javascripts/jqueryui.js.tt} +0 -0
  97. data/lib/generators/jquery/datatables/templates/{material.js.tt → javascripts/material.js.tt} +0 -0
  98. data/lib/generators/jquery/datatables/templates/{regular.js.tt → javascripts/regular.js.tt} +0 -0
  99. data/lib/generators/jquery/datatables/templates/{semanticui.js.tt → javascripts/semanticui.js.tt} +0 -0
  100. data/lib/generators/jquery/datatables/templates/{uikit.js.tt → javascripts/uikit.js.tt} +0 -0
  101. data/lib/generators/jquery/datatables/templates/{bootstrap.scss.tt → stylesheets/bootstrap.scss.tt} +0 -0
  102. data/lib/generators/jquery/datatables/templates/{bootstrap4.scss.tt → stylesheets/bootstrap4.scss.tt} +0 -0
  103. data/lib/generators/jquery/datatables/templates/{foundation.scss.tt → stylesheets/foundation.scss.tt} +0 -0
  104. data/lib/generators/jquery/datatables/templates/{jqueryui.scss.tt → stylesheets/jqueryui.scss.tt} +0 -0
  105. data/lib/generators/jquery/datatables/templates/{material.scss.tt → stylesheets/material.scss.tt} +0 -0
  106. data/lib/generators/jquery/datatables/templates/{regular.scss.tt → stylesheets/regular.scss.tt} +0 -0
  107. data/lib/generators/jquery/datatables/templates/{semanticui.scss.tt → stylesheets/semanticui.scss.tt} +0 -0
  108. data/lib/generators/jquery/datatables/templates/{uikit.scss.tt → stylesheets/uikit.scss.tt} +0 -0
  109. data/lib/generators/jquery/datatables/templates/views/index.html.erb +17 -0
  110. data/lib/generators/jquery/datatables/templates/views/index.html.slim +12 -0
  111. data/lib/generators/jquery/datatables/templates/views/index.json.jbuilder +10 -0
  112. data/lib/jquery-datatables.rb +53 -5
  113. data/lib/jquery-datatables/engine.rb +2 -0
  114. data/lib/jquery-datatables/version.rb +1 -1
  115. metadata +86 -31
@@ -0,0 +1,38 @@
1
+ /*! jQuery UI styling wrapper for RowReorder
2
+ * ©2018 SpryMedia Ltd - datatables.net/license
3
+ */
4
+
5
+ (function( factory ){
6
+ if ( typeof define === 'function' && define.amd ) {
7
+ // AMD
8
+ define( ['jquery', 'datatables.net-jqui', 'datatables.net-rowreorder'], function ( $ ) {
9
+ return factory( $, window, document );
10
+ } );
11
+ }
12
+ else if ( typeof exports === 'object' ) {
13
+ // CommonJS
14
+ module.exports = function (root, $) {
15
+ if ( ! root ) {
16
+ root = window;
17
+ }
18
+
19
+ if ( ! $ || ! $.fn.dataTable ) {
20
+ $ = require('datatables.net-jqui')(root, $).$;
21
+ }
22
+
23
+ if ( ! $.fn.dataTable.RowReorder ) {
24
+ require('datatables.net-rowreorder')(root, $);
25
+ }
26
+
27
+ return factory( $, root, root.document );
28
+ };
29
+ }
30
+ else {
31
+ // Browser
32
+ factory( jQuery, window, document );
33
+ }
34
+ }(function( $, window, document, undefined ) {
35
+
36
+ return $.fn.dataTable;
37
+
38
+ }));
@@ -0,0 +1,38 @@
1
+ /*! Semanic UI styling wrapper for RowReorder
2
+ * ©2018 SpryMedia Ltd - datatables.net/license
3
+ */
4
+
5
+ (function( factory ){
6
+ if ( typeof define === 'function' && define.amd ) {
7
+ // AMD
8
+ define( ['jquery', 'datatables.net-se', 'datatables.net-rowreorder'], function ( $ ) {
9
+ return factory( $, window, document );
10
+ } );
11
+ }
12
+ else if ( typeof exports === 'object' ) {
13
+ // CommonJS
14
+ module.exports = function (root, $) {
15
+ if ( ! root ) {
16
+ root = window;
17
+ }
18
+
19
+ if ( ! $ || ! $.fn.dataTable ) {
20
+ $ = require('datatables.net-se')(root, $).$;
21
+ }
22
+
23
+ if ( ! $.fn.dataTable.RowReorder ) {
24
+ require('datatables.net-rowreorder')(root, $);
25
+ }
26
+
27
+ return factory( $, root, root.document );
28
+ };
29
+ }
30
+ else {
31
+ // Browser
32
+ factory( jQuery, window, document );
33
+ }
34
+ }(function( $, window, document, undefined ) {
35
+
36
+ return $.fn.dataTable;
37
+
38
+ }));
@@ -1,15 +1,15 @@
1
- /*! Scroller 1.4.3
2
- * ©2011-2017 SpryMedia Ltd - datatables.net/license
1
+ /*! Scroller 1.5.0
2
+ * ©2011-2018 SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
5
5
  /**
6
6
  * @summary Scroller
7
7
  * @description Virtual rendering for DataTables
8
- * @version 1.4.3
8
+ * @version 1.5.0
9
9
  * @file dataTables.scroller.js
10
10
  * @author SpryMedia Ltd (www.sprymedia.co.uk)
11
11
  * @contact www.sprymedia.co.uk/contact
12
- * @copyright Copyright 2011-2017 SpryMedia Ltd.
12
+ * @copyright Copyright 2011-2018 SpryMedia Ltd.
13
13
  *
14
14
  * This source file is free software, available under the following license:
15
15
  * MIT license - http://datatables.net/license/mit
@@ -109,6 +109,8 @@ var Scroller = function ( dt, opts ) {
109
109
  opts = {};
110
110
  }
111
111
 
112
+ var dtApi = $.fn.dataTable.Api( dt );
113
+
112
114
  /**
113
115
  * Settings object which contains customisable information for the Scroller instance
114
116
  * @namespace
@@ -121,7 +123,13 @@ var Scroller = function ( dt, opts ) {
121
123
  * @type object
122
124
  * @default Passed in as first parameter to constructor
123
125
  */
124
- "dt": $.fn.dataTable.Api( dt ).settings()[0],
126
+ "dt": dtApi.settings()[0],
127
+
128
+ /**
129
+ * DataTables API instance
130
+ * @type DataTable.Api
131
+ */
132
+ "dtApi": dtApi,
125
133
 
126
134
  /**
127
135
  * Pixel location of the top of the drawn table in the viewport
@@ -275,13 +283,15 @@ $.extend( Scroller.prototype, {
275
283
  "fnRowToPixels": function ( rowIdx, intParse, virtual )
276
284
  {
277
285
  var pixels;
286
+ var diff = rowIdx - this.s.baseRowTop;
278
287
 
279
288
  if ( virtual ) {
280
- pixels = this._domain( 'virtualToPhysical', rowIdx * this.s.heights.row );
289
+ pixels = this._domain( 'virtualToPhysical', this.s.baseScrollTop );
290
+ pixels += diff * this.s.heights.row;
281
291
  }
282
292
  else {
283
- var diff = rowIdx - this.s.baseRowTop;
284
- pixels = this.s.baseScrollTop + (diff * this.s.heights.row);
293
+ pixels = this.s.baseScrollTop;
294
+ pixels += diff * this.s.heights.row;
285
295
  }
286
296
 
287
297
  return intParse || intParse === undefined ?
@@ -320,7 +330,7 @@ $.extend( Scroller.prototype, {
320
330
  {
321
331
  var diff = pixels - this.s.baseScrollTop;
322
332
  var row = virtual ?
323
- this._domain( 'physicalToVirtual', pixels ) / this.s.heights.row :
333
+ (this._domain( 'physicalToVirtual', this.s.baseScrollTop ) + diff) / this.s.heights.row :
324
334
  ( diff / this.s.heights.row ) + this.s.baseRowTop;
325
335
 
326
336
  return intParse || intParse === undefined ?
@@ -371,7 +381,7 @@ $.extend( Scroller.prototype, {
371
381
 
372
382
  if ( (px > this.s.redrawBottom || px < this.s.redrawTop) && this.s.dt._iDisplayStart !== drawRow ) {
373
383
  ani = true;
374
- px = this.fnRowToPixels( iRow, false, true );
384
+ px = this._domain( 'virtualToPhysical', iRow * this.s.heights.row );
375
385
 
376
386
  // If we need records outside the current draw region, but the new
377
387
  // scrolling position is inside that (due to the non-linear nature
@@ -498,6 +508,7 @@ $.extend( Scroller.prototype, {
498
508
  "_fnConstruct": function ()
499
509
  {
500
510
  var that = this;
511
+ var dt = this.s.dtApi;
501
512
 
502
513
  /* Sanity check */
503
514
  if ( !this.s.dt.oFeatures.bPaginate ) {
@@ -523,7 +534,7 @@ $.extend( Scroller.prototype, {
523
534
  this.dom.table.style.left = "0px";
524
535
 
525
536
  // Add class to 'announce' that we are a Scroller table
526
- $(this.s.dt.nTableWrapper).addClass('DTS');
537
+ $(dt.table().container()).addClass('DTS');
527
538
 
528
539
  // Add a 'loading' indicator
529
540
  if ( this.s.loadingIndicator )
@@ -543,84 +554,84 @@ $.extend( Scroller.prototype, {
543
554
  }
544
555
  this.fnMeasure( false );
545
556
 
546
- /* Scrolling callback to see if a page change is needed - use a throttled
547
- * function for the save save callback so we aren't hitting it on every
548
- * scroll
549
- */
557
+ // Scrolling callback to see if a page change is needed - use a throttled
558
+ // function for the save save callback so we aren't hitting it on every
559
+ // scroll
550
560
  this.s.ingnoreScroll = true;
551
561
  this.s.stateSaveThrottle = this.s.dt.oApi._fnThrottle( function () {
552
- that.s.dt.oApi._fnSaveState( that.s.dt );
562
+ that.s.dtApi.state.save();
553
563
  }, 500 );
554
- $(this.dom.scroller).on( 'scroll.DTS', function (e) {
564
+ $(this.dom.scroller).on( 'scroll.dt-scroller', function (e) {
555
565
  that._fnScroll.call( that );
556
566
  } );
557
567
 
558
- /* In iOS we catch the touchstart event in case the user tries to scroll
559
- * while the display is already scrolling
560
- */
561
- $(this.dom.scroller).on('touchstart.DTS', function () {
568
+ // In iOS we catch the touchstart event in case the user tries to scroll
569
+ // while the display is already scrolling
570
+ $(this.dom.scroller).on('touchstart.dt-scroller', function () {
562
571
  that._fnScroll.call( that );
563
572
  } );
564
573
 
565
- /* Update the scroller when the DataTable is redrawn */
566
- this.s.dt.aoDrawCallback.push( {
567
- "fn": function () {
568
- if ( that.s.dt.bInitialised ) {
569
- that._fnDrawCallback.call( that );
570
- }
571
- },
572
- "sName": "Scroller"
573
- } );
574
-
575
- /* On resize, update the information element, since the number of rows shown might change */
576
- $(window).on( 'resize.DTS', function () {
574
+ // On resize, update the information element, since the number of rows shown might change
575
+ $(window).on( 'resize.dt-scroller', function () {
577
576
  that.fnMeasure( false );
578
577
  that._fnInfo();
579
578
  } );
580
579
 
581
- /* Add a state saving parameter to the DT state saving so we can restore the exact
582
- * position of the scrolling
583
- */
580
+ // Add a state saving parameter to the DT state saving so we can restore the exact
581
+ // position of the scrolling. Slightly surprisingly the scroll position isn't actually
582
+ // stored, but rather tha base units which are needed to calculate it. This allows for
583
+ // virtual scrolling as well.
584
584
  var initialStateSave = true;
585
- this.s.dt.oApi._fnCallbackReg( this.s.dt, 'aoStateSaveParams', function (oS, oData) {
586
- /* Set iScroller to saved scroll position on initialization.
587
- */
588
- if(initialStateSave && that.s.dt.oLoadedState){
589
- oData.iScroller = that.s.dt.oLoadedState.iScroller;
590
- oData.iScrollerTopRow = that.s.dt.oLoadedState.iScrollerTopRow;
591
- initialStateSave = false;
592
- } else {
593
- oData.iScroller = that.dom.scroller.scrollTop;
594
- oData.iScrollerTopRow = that.s.topRowFloat;
595
- }
596
- }, "Scroller_State" );
585
+ var loadedState = dt.state.loaded();
586
+
587
+ dt.on( 'stateSaveParams.scroller', function ( e, settings, data ) {
588
+ // Need to used the saved position on init
589
+ data.scroller = {
590
+ topRow: initialStateSave && loadedState && loadedState.scroller ?
591
+ loadedState.scroller.topRow :
592
+ that.s.topRowFloat,
593
+ baseScrollTop: that.s.baseScrollTop,
594
+ baseRowTop: that.s.baseRowTop
595
+ };
596
+
597
+ initialStateSave = false;
598
+ } );
597
599
 
598
- if ( this.s.dt.oLoadedState ) {
599
- this.s.topRowFloat = this.s.dt.oLoadedState.iScrollerTopRow || 0;
600
+ if ( loadedState && loadedState.scroller ) {
601
+ this.s.topRowFloat = loadedState.scroller.topRow;
602
+ this.s.baseScrollTop = loadedState.scroller.baseScrollTop;
603
+ this.s.baseRowTop = loadedState.scroller.baseRowTop;
600
604
  }
601
605
 
602
- // Measure immediately. Scroller will have been added using preInit, so
603
- // we can reliably do this here. We could potentially also measure on
604
- // init complete, which would be useful for cases where the data is Ajax
605
- // loaded and longer than a single line.
606
- $(this.s.dt.nTable).one( 'init.dt', function () {
607
- that.fnMeasure();
606
+ dt.on( 'init.scroller', function () {
607
+ that.fnMeasure( false );
608
+
609
+ that._fnDrawCallback();
610
+
611
+ // Update the scroller when the DataTable is redrawn
612
+ dt.on( 'draw.scroller', function () {
613
+ that._fnDrawCallback();
614
+ });
608
615
  } );
609
616
 
610
- /* Destructor */
611
- this.s.dt.aoDestroyCallback.push( {
612
- "sName": "Scroller",
613
- "fn": function () {
614
- $(window).off( 'resize.DTS' );
615
- $(that.dom.scroller).off('touchstart.DTS scroll.DTS');
616
- $(that.s.dt.nTableWrapper).removeClass('DTS');
617
- $('div.DTS_Loading', that.dom.scroller.parentNode).remove();
618
- $(that.s.dt.nTable).off( 'init.dt' );
619
-
620
- that.dom.table.style.position = "";
621
- that.dom.table.style.top = "";
622
- that.dom.table.style.left = "";
623
- }
617
+ // Set height before the draw happens, allowing everything else to update
618
+ // on draw complete without worry for roder.
619
+ dt.on( 'preDraw.dt.scroller', function () {
620
+ that._fnScrollForce();
621
+ } );
622
+
623
+ // Destructor
624
+ dt.on( 'destroy.scroller', function () {
625
+ $(window).off( 'resize.dt-scroller' );
626
+ $(that.dom.scroller).off('.dt-scroller');
627
+ $(that.s.dt.nTable).off( '.scroller' );
628
+
629
+ $(that.s.dt.nTableWrapper).removeClass('DTS');
630
+ $('div.DTS_Loading', that.dom.scroller.parentNode).remove();
631
+
632
+ that.dom.table.style.position = "";
633
+ that.dom.table.style.top = "";
634
+ that.dom.table.style.left = "";
624
635
  } );
625
636
  },
626
637
 
@@ -667,7 +678,7 @@ $.extend( Scroller.prototype, {
667
678
  */
668
679
  clearTimeout( this.s.stateTO );
669
680
  this.s.stateTO = setTimeout( function () {
670
- that.s.dt.oApi._fnSaveState( that.s.dt );
681
+ that.s.dtApi.state.save();
671
682
  }, 250 );
672
683
 
673
684
  /* Check if the scroll point is outside the trigger boundary which would required
@@ -677,15 +688,8 @@ $.extend( Scroller.prototype, {
677
688
 
678
689
  var preRows = Math.ceil( ((this.s.displayBuffer-1)/2) * this.s.viewportRows );
679
690
 
680
- if ( Math.abs( iScrollTop - this.s.lastScrollTop ) > heights.viewport || this.s.ani || this.s.forceReposition ) {
681
- iTopRow = parseInt(this._domain( 'physicalToVirtual', iScrollTop ) / heights.row, 10) - preRows;
682
- this.s.topRowFloat = this._domain( 'physicalToVirtual', iScrollTop ) / heights.row;
683
- }
684
- else {
685
- iTopRow = this.fnPixelsToRow( iScrollTop ) - preRows;
686
- this.s.topRowFloat = this.fnPixelsToRow( iScrollTop, false );
687
- }
688
-
691
+ iTopRow = parseInt(this._domain( 'physicalToVirtual', iScrollTop ) / heights.row, 10) - preRows;
692
+ this.s.topRowFloat = this._domain( 'physicalToVirtual', iScrollTop ) / heights.row;
689
693
  this.s.forceReposition = false;
690
694
 
691
695
  if ( iTopRow <= 0 ) {
@@ -738,7 +742,7 @@ $.extend( Scroller.prototype, {
738
742
  }
739
743
  }
740
744
  else {
741
- this.s.topRowFloat = this._domain( 'physicalToVirtual', iScrollTop ) / heights.row;
745
+ this.s.topRowFloat = this.fnPixelsToRow( iScrollTop, false, true );
742
746
  }
743
747
 
744
748
  this.s.lastScrollTop = iScrollTop;
@@ -866,8 +870,10 @@ $.extend( Scroller.prototype, {
866
870
  // Disable the scroll event listener while we are updating the DOM
867
871
  this.s.skip = true;
868
872
 
869
- // Resize the scroll forcing element
870
- this._fnScrollForce();
873
+ // If paging is reset
874
+ if ( (this.s.dt.bSorted || this.s.dt.bFiltered) && displayStart === 0 ) {
875
+ this.s.topRowFloat = 0;
876
+ }
871
877
 
872
878
  // Reposition the scrolling for the updated virtual position if needed
873
879
  if ( displayStart === 0 ) {
@@ -1278,7 +1284,7 @@ Scroller.oDefaults = Scroller.defaults;
1278
1284
  * @name Scroller.version
1279
1285
  * @static
1280
1286
  */
1281
- Scroller.version = "1.4.3";
1287
+ Scroller.version = "1.5.0";
1282
1288
 
1283
1289
 
1284
1290
 
@@ -1359,11 +1365,11 @@ Api.register( 'scroller().pixelsToRow()', function ( pixels, intParse, virtual )
1359
1365
  // undefined
1360
1366
  } );
1361
1367
 
1362
- // Undocumented and deprecated - use `row().scrollTo()` instead
1363
- Api.register( 'scroller().scrollToRow()', function ( row, ani ) {
1368
+ // `scroller().scrollToRow()` is undocumented and deprecated. Use `scroller.toPosition()
1369
+ Api.register( ['scroller().scrollToRow()', 'scroller.toPosition()'], function ( idx, ani ) {
1364
1370
  this.iterator( 'table', function ( ctx ) {
1365
1371
  if ( ctx.oScroller ) {
1366
- ctx.oScroller.fnScrollToRow( row, ani );
1372
+ ctx.oScroller.fnScrollToRow( idx, ani );
1367
1373
  }
1368
1374
  } );
1369
1375
 
@@ -0,0 +1,38 @@
1
+ /*! Bootstrap 3 styling wrapper for Scroller
2
+ * ©2018 SpryMedia Ltd - datatables.net/license
3
+ */
4
+
5
+ (function( factory ){
6
+ if ( typeof define === 'function' && define.amd ) {
7
+ // AMD
8
+ define( ['jquery', 'datatables.net-bs', 'datatables.net-scroller'], function ( $ ) {
9
+ return factory( $, window, document );
10
+ } );
11
+ }
12
+ else if ( typeof exports === 'object' ) {
13
+ // CommonJS
14
+ module.exports = function (root, $) {
15
+ if ( ! root ) {
16
+ root = window;
17
+ }
18
+
19
+ if ( ! $ || ! $.fn.dataTable ) {
20
+ $ = require('datatables.net-bs')(root, $).$;
21
+ }
22
+
23
+ if ( ! $.fn.dataTable.Scroller ) {
24
+ require('datatables.net-scroller')(root, $);
25
+ }
26
+
27
+ return factory( $, root, root.document );
28
+ };
29
+ }
30
+ else {
31
+ // Browser
32
+ factory( jQuery, window, document );
33
+ }
34
+ }(function( $, window, document, undefined ) {
35
+
36
+ return $.fn.dataTable;
37
+
38
+ }));
@@ -0,0 +1,38 @@
1
+ /*! Bootstrap 4 styling wrapper for Scroller
2
+ * ©2018 SpryMedia Ltd - datatables.net/license
3
+ */
4
+
5
+ (function( factory ){
6
+ if ( typeof define === 'function' && define.amd ) {
7
+ // AMD
8
+ define( ['jquery', 'datatables.net-bs4', 'datatables.net-scroller'], function ( $ ) {
9
+ return factory( $, window, document );
10
+ } );
11
+ }
12
+ else if ( typeof exports === 'object' ) {
13
+ // CommonJS
14
+ module.exports = function (root, $) {
15
+ if ( ! root ) {
16
+ root = window;
17
+ }
18
+
19
+ if ( ! $ || ! $.fn.dataTable ) {
20
+ $ = require('datatables.net-bs4')(root, $).$;
21
+ }
22
+
23
+ if ( ! $.fn.dataTable.Scroller ) {
24
+ require('datatables.net-scroller')(root, $);
25
+ }
26
+
27
+ return factory( $, root, root.document );
28
+ };
29
+ }
30
+ else {
31
+ // Browser
32
+ factory( jQuery, window, document );
33
+ }
34
+ }(function( $, window, document, undefined ) {
35
+
36
+ return $.fn.dataTable;
37
+
38
+ }));