jquery-datatables 1.10.19.1 → 1.10.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +1 -0
  3. data/README.md +28 -1
  4. data/app/assets/javascripts/datatables/dataTables.uikit.js +2 -2
  5. data/app/assets/javascripts/datatables/extensions/AutoFill/dataTables.autoFill.js +42 -29
  6. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.bootstrap.js +1 -1
  7. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.bootstrap4.js +8 -2
  8. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.colVis.js +6 -3
  9. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.foundation.js +5 -4
  10. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.html5.js +58 -6
  11. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.print.js +16 -5
  12. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.semanticui.js +1 -1
  13. data/app/assets/javascripts/datatables/extensions/Buttons/dataTables.buttons.js +267 -152
  14. data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.foundation.js +1 -1
  15. data/app/assets/javascripts/datatables/extensions/ColReorder/dataTables.colReorder.js +121 -52
  16. data/app/assets/javascripts/datatables/extensions/FixedColumns/dataTables.fixedColumns.js +32 -5
  17. data/app/assets/javascripts/datatables/extensions/KeyTable/dataTables.keyTable.js +166 -63
  18. data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.foundation.js +1 -1
  19. data/app/assets/javascripts/datatables/extensions/RowGroup/dataTables.rowGroup.js +105 -53
  20. data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.foundation.js +1 -1
  21. data/app/assets/javascripts/datatables/extensions/RowGroup/{rowGroup.semanicui.js → rowGroup.semanticui.js} +0 -0
  22. data/app/assets/javascripts/datatables/extensions/RowReorder/dataTables.rowReorder.js +10 -9
  23. data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.foundation.js +1 -1
  24. data/app/assets/javascripts/datatables/extensions/Scroller/dataTables.scroller.js +519 -636
  25. data/app/assets/javascripts/datatables/extensions/Scroller/scroller.foundation.js +1 -1
  26. data/app/assets/javascripts/datatables/extensions/Select/dataTables.select.js +49 -18
  27. data/app/assets/javascripts/datatables/extensions/Select/select.foundation.js +1 -1
  28. data/app/assets/javascripts/datatables/jquery.dataTables.js +97 -60
  29. data/app/assets/javascripts/datatables/plugins/api/average.js +7 -6
  30. data/app/assets/javascripts/datatables/plugins/api/sum.js +7 -6
  31. data/app/assets/javascripts/datatables/plugins/pagination/ellipses.js +160 -0
  32. data/app/assets/javascripts/datatables/plugins/pagination/extjs.js +137 -0
  33. data/app/assets/javascripts/datatables/plugins/pagination/four_button.js +110 -0
  34. data/app/assets/javascripts/datatables/plugins/pagination/full_numbers_no_ellipses.js +59 -0
  35. data/app/assets/javascripts/datatables/plugins/pagination/input.js +22 -19
  36. data/app/assets/javascripts/datatables/plugins/pagination/scrolling.js +130 -0
  37. data/app/assets/javascripts/datatables/plugins/pagination/select.js +97 -0
  38. data/app/assets/javascripts/datatables/plugins/pagination/simple_incremental_bootstrap.js +154 -0
  39. data/app/assets/javascripts/datatables/plugins/pagination/simple_numbers_no_ellipses.js +59 -0
  40. data/app/assets/javascripts/datatables/plugins/search/dataTables.alphabetSearch.js +440 -399
  41. data/app/assets/javascripts/datatables/plugins/sorting/enum.js +51 -0
  42. data/app/assets/javascripts/datatables/plugins/type-detection/date-dd-MMM-yyyy.js +63 -0
  43. data/app/assets/javascripts/datatables/plugins/type-detection/date-de.js +125 -0
  44. data/app/assets/javascripts/datatables/plugins/type-detection/date-eu.js +64 -0
  45. data/app/assets/javascripts/datatables/plugins/type-detection/date-euro.js +48 -0
  46. data/app/assets/javascripts/datatables/plugins/type-detection/date-uk.js +35 -12
  47. data/app/assets/javascripts/datatables/plugins/type-detection/datetime-moment.js +74 -0
  48. data/app/assets/javascripts/datatables/plugins/type-detection/datetime-us.js +86 -0
  49. data/app/assets/javascripts/datatables/plugins/type-detection/file-size.js +37 -13
  50. data/app/assets/javascripts/datatables/plugins/type-detection/ip-address.js +113 -11
  51. data/app/assets/javascripts/datatables/plugins/type-detection/numString.js +63 -0
  52. data/app/assets/javascripts/datatables/plugins/type-detection/percent.js +34 -0
  53. data/app/assets/javascripts/datatables/plugins/type-detection/time-elapsed-dhms.js +42 -0
  54. data/app/assets/javascripts/datatables/plugins/type-detection/time.js +56 -0
  55. data/app/assets/javascripts/datatables/plugins/type-detection/title-numeric.js +40 -0
  56. data/app/assets/javascripts/datatables/plugins/type-detection/title-string.js +36 -0
  57. data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.dataTables.scss +10 -3
  58. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.bootstrap.scss +12 -3
  59. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.bootstrap4.scss +13 -6
  60. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.dataTables.scss +2 -0
  61. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.foundation.scss +5 -1
  62. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.jqueryui.scss +1 -0
  63. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.semanticui.scss +2 -1
  64. data/app/assets/stylesheets/datatables/extensions/Buttons/common.scss +10 -0
  65. data/app/assets/stylesheets/datatables/extensions/Buttons/mixins.scss +42 -30
  66. data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.bootstrap.scss +11 -7
  67. data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.foundation.scss +1 -0
  68. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.dataTables.scss +13 -5
  69. data/app/assets/stylesheets/datatables/extensions/RowGroup/rowGroup.dataTables.scss +20 -2
  70. data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.dataTables.scss +15 -2
  71. data/lib/jquery-datatables/version.rb +1 -1
  72. metadata +26 -12
  73. data/app/assets/javascripts/datatables/dataTables.bootstrap2.js +0 -162
  74. data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.semanicui.js +0 -38
  75. data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.semanicui.js +0 -38
  76. data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.semanicui.js +0 -38
  77. data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.semanicui.js +0 -38
  78. data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.semanicui.js +0 -38
  79. data/app/assets/stylesheets/datatables/dataTables.bootstrap2.scss +0 -178
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3936ef3777916cd9d6f39a22d8aad261d824f2d02d7f025a27f8b8e9926a6347
4
- data.tar.gz: a33031ddbfebb05c0ec78bc71182c2fff3388dcb01f2ee81ecbfad4ecf6152b5
3
+ metadata.gz: f7a56fe04ecf89c43234bf967bc23952b91b99f00715c6d9f86bb19b7c70eaf7
4
+ data.tar.gz: b4de1b400a35c57b0e0ab3d209ba70428b9a60a3f6ee305376a14c6c4d6d0b39
5
5
  SHA512:
6
- metadata.gz: d0b8f22bd0015e55a98639b3fdc10e253d8047b53b18d2c41b3bc83fb3a4f011632a00273c66592d0d202bff2d19a400d3b92bc1d8716af8c6a7700dec19fdd0
7
- data.tar.gz: 30d04d5649f00140fb4d22e242f38cebcec62c21787a50e7916d2176e90186a48a37725794c1b6987ae3420cd8c528bdae7a24203ad9cd53dcb2cf94089f1c31
6
+ metadata.gz: 8447a4fc4bdcc44a3eb0e9aef4891e2bb135c4f0932b644bcb9f4358cb687d12562a67557c04e9901efca6dca4842c3167cbae0c082c6ffa14fdca5bfd090c1f
7
+ data.tar.gz: dc0d16e4518677b068d7fa84cc881de5a31d71779a806d8983b8735213c324b806ab17dca424b15321b70be9ccfb1c74742bd97c5ff963f31ad3b91167ce8b23
@@ -0,0 +1 @@
1
+ app/assets/* linguist-vendored
data/README.md CHANGED
@@ -7,8 +7,16 @@ Include [jQuery DataTables](http://www.datatables.net/) in your asset pipeline w
7
7
 
8
8
  ### Requirements
9
9
 
10
+ **Rails 6.0+**
11
+ Since Webpacker the default JavaScript compiler for Rails 6. you can install via yarn.
12
+
13
+ see this [official](https://datatables.net/download/index) pages for details.
14
+
15
+ However, if your app still using javascript with sprockets, this gem is still good to go.
16
+
17
+
10
18
  **Rails 5.1+**
11
- The Rails JavaScript helpers has been rewritten in a new gem called rails-ujs and they use vanilla JavaScript, so jQuery is not a dependency of Rails anymore. Since materializecss relies on it, install it with ```bin/yarn add jquery``` or via ```gem 'jquery-rails'``` and add ```//= require jquery``` to ```application.js```.
19
+ The Rails JavaScript helpers has been rewritten in a new gem called rails-ujs and they use vanilla JavaScript, so jQuery is not a dependency of Rails anymore. Since Jquery datatables relies on it, install it with ```bin/yarn add jquery``` or via ```gem 'jquery-rails'``` and add ```//= require jquery``` to ```application.js```.
12
20
 
13
21
  **NOTE:** Ensure that the `sass-rails` gem is presented in your Gemfile.
14
22
 
@@ -125,6 +133,25 @@ $(document).ready(function() {
125
133
  });
126
134
  ```
127
135
 
136
+ And you will of course, need to have a html table (with a theader and tbody) with the id set to dttb. Here is an example:
137
+
138
+ ```html
139
+ <table id="dttb" class="table table-hover">
140
+ <thead>
141
+ <tr>
142
+ <th> Panel No</th>
143
+ </tr>
144
+ </thead>
145
+ <tbody>
146
+ <% @panels.each do |panel| %>
147
+ <tr>
148
+ <td><%= link_to panel.no, panel %></td>
149
+ </tr>
150
+ <% end %>
151
+ </tbody>
152
+ </table>
153
+ ```
154
+
128
155
  ### Server Side processing
129
156
 
130
157
  Recommended use this gem
@@ -50,8 +50,8 @@ $.extend( true, DataTable.defaults, {
50
50
  /* Default class modification */
51
51
  $.extend( DataTable.ext.classes, {
52
52
  sWrapper: "dataTables_wrapper uk-form dt-uikit",
53
- sFilterInput: "uk-form-small",
54
- sLengthSelect: "uk-form-small",
53
+ sFilterInput: "uk-form-small uk-input",
54
+ sLengthSelect: "uk-form-small uk-select",
55
55
  sProcessing: "dataTables_processing uk-panel"
56
56
  } );
57
57
 
@@ -1,15 +1,15 @@
1
- /*! AutoFill 2.3.1
2
- * ©2008-2018 SpryMedia Ltd - datatables.net/license
1
+ /*! AutoFill 2.3.4
2
+ * ©2008-2019 SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
5
5
  /**
6
6
  * @summary AutoFill
7
7
  * @description Add Excel like click and drag auto-fill options to DataTables
8
- * @version 2.3.1
8
+ * @version 2.3.4
9
9
  * @file dataTables.autoFill.js
10
10
  * @author SpryMedia Ltd (www.sprymedia.co.uk)
11
11
  * @contact www.sprymedia.co.uk/contact
12
- * @copyright Copyright 2010-2018 SpryMedia Ltd.
12
+ * @copyright Copyright 2010-2019 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
@@ -367,7 +367,8 @@ $.extend( AutoFill.prototype, {
367
367
  start.column
368
368
  };
369
369
  var colIndx = dt.column.index( 'toData', end.column );
370
- var endCell = $( dt.cell( ':eq('+end.row+')', colIndx ).node() );
370
+ var endRow = dt.row( ':eq('+end.row+')', { page: 'current' } ); // Workaround for M581
371
+ var endCell = $( dt.cell( endRow.index(), colIndx ).node() );
371
372
 
372
373
  // Be sure that is a DataTables controlled cell
373
374
  if ( ! dt.cell( endCell ).any() ) {
@@ -388,10 +389,10 @@ $.extend( AutoFill.prototype, {
388
389
  left = start.column < end.column ? startCell : endCell;
389
390
  right = start.column < end.column ? endCell : startCell;
390
391
 
391
- top = this._getPosition( top ).top;
392
- left = this._getPosition( left ).left;
393
- height = this._getPosition( bottom ).top + bottom.outerHeight() - top;
394
- width = this._getPosition( right ).left + right.outerWidth() - left;
392
+ top = this._getPosition( top.get(0) ).top;
393
+ left = this._getPosition( left.get(0) ).left;
394
+ height = this._getPosition( bottom.get(0) ).top + bottom.outerHeight() - top;
395
+ width = this._getPosition( right.get(0) ).left + right.outerWidth() - left;
395
396
 
396
397
  var select = this.dom.select;
397
398
  select.top.css( {
@@ -584,9 +585,8 @@ $.extend( AutoFill.prototype, {
584
585
  _getPosition: function ( node, targetParent )
585
586
  {
586
587
  var
587
- currNode = $(node),
588
+ currNode = node,
588
589
  currOffsetParent,
589
- position,
590
590
  top = 0,
591
591
  left = 0;
592
592
 
@@ -595,23 +595,23 @@ $.extend( AutoFill.prototype, {
595
595
  }
596
596
 
597
597
  do {
598
- position = currNode.position();
598
+ // Don't use jQuery().position() the behaviour changes between 1.x and 3.x for
599
+ // tables
600
+ var positionTop = currNode.offsetTop;
601
+ var positionLeft = currNode.offsetLeft;
599
602
 
600
603
  // jQuery doesn't give a `table` as the offset parent oddly, so use DOM directly
601
- currOffsetParent = $( currNode[0].offsetParent );
604
+ currOffsetParent = $( currNode.offsetParent );
602
605
 
603
- top += position.top + currOffsetParent.scrollTop();
604
- left += position.left + currOffsetParent.scrollLeft();
605
-
606
- top += parseInt( currOffsetParent.css('margin-top') ) * 1;
607
- top += parseInt( currOffsetParent.css('border-top-width') ) * 1;
606
+ top += positionTop + parseInt( currOffsetParent.css('border-top-width') ) * 1;
607
+ left += positionLeft + parseInt( currOffsetParent.css('border-left-width') ) * 1;
608
608
 
609
609
  // Emergency fall back. Shouldn't happen, but just in case!
610
- if ( currNode.get(0).nodeName.toLowerCase() === 'body' ) {
610
+ if ( currNode.nodeName.toLowerCase() === 'body' ) {
611
611
  break;
612
612
  }
613
613
 
614
- currNode = currOffsetParent; // for next loop
614
+ currNode = currOffsetParent.get(0); // for next loop
615
615
  }
616
616
  while ( currOffsetParent.get(0) !== targetParent.get(0) )
617
617
 
@@ -731,14 +731,18 @@ $.extend( AutoFill.prototype, {
731
731
  var editor = dt.editor();
732
732
 
733
733
  editor
734
- .on( 'submitSuccess.kt', function () {
735
- editor.off( '.kt');
736
- that._mouseup( e );
734
+ .on( 'submitSuccess.dtaf close.dtaf', function () {
735
+ editor.off( '.dtaf');
736
+
737
+ setTimeout( function () {
738
+ that._mouseup( e );
739
+ }, 100 );
737
740
  } )
738
- .on( 'submitComplete.kt preSubmitCancelled.kt', function () {
739
- editor.off( '.kt');
741
+ .on( 'submitComplete.dtaf preSubmitCancelled.dtaf close.dtaf', function () {
742
+ editor.off( '.dtaf');
740
743
  } );
741
-
744
+
745
+ // Make the current input submit
742
746
  editor.submit();
743
747
 
744
748
  return;
@@ -750,6 +754,7 @@ $.extend( AutoFill.prototype, {
750
754
  var selected = [];
751
755
  var dtSettings = dt.settings()[0];
752
756
  var dtColumns = dtSettings.aoColumns;
757
+ var enabledColumns = dt.columns( this.c.columns ).indexes();
753
758
 
754
759
  // Can't use Array.prototype.map as IE8 doesn't support it
755
760
  // Can't use $.map as jQuery flattens 2D arrays
@@ -757,7 +762,8 @@ $.extend( AutoFill.prototype, {
757
762
  for ( var rowIdx=0 ; rowIdx<rows.length ; rowIdx++ ) {
758
763
  selected.push(
759
764
  $.map( columns, function (column) {
760
- var cell = dt.cell( ':eq('+rows[rowIdx]+')', column+':visible', {page:'current'} );
765
+ var row = dt.row( ':eq('+rows[rowIdx]+')', {page:'current'} ); // Workaround for M581
766
+ var cell = dt.cell( row.index(), column+':visible' );
761
767
  var data = cell.data();
762
768
  var cellIndex = cell.index();
763
769
  var editField = dtColumns[ cellIndex.column ].editField;
@@ -766,6 +772,10 @@ $.extend( AutoFill.prototype, {
766
772
  data = dtSettings.oApi._fnGetObjectDataFn( editField )( dt.row( cellIndex.row ).data() );
767
773
  }
768
774
 
775
+ if ( enabledColumns.indexOf(cellIndex.column) === -1 ) {
776
+ return;
777
+ }
778
+
769
779
  return {
770
780
  cell: cell,
771
781
  data: data,
@@ -938,6 +948,7 @@ $.extend( AutoFill.prototype, {
938
948
 
939
949
  var dt = this.s.dt;
940
950
  var cell;
951
+ var columns = dt.columns( this.c.columns ).indexes();
941
952
 
942
953
  // Potentially allow modifications to the cells matrix
943
954
  this._emitEvent( 'preAutoFill', [ dt, cells ] );
@@ -958,7 +969,9 @@ $.extend( AutoFill.prototype, {
958
969
  for ( var j=0, jen=cells[i].length ; j<jen ; j++ ) {
959
970
  cell = cells[i][j];
960
971
 
961
- cell.cell.data( cell.set );
972
+ if ( columns.indexOf(cell.index.column) !== -1 ) {
973
+ cell.cell.data( cell.set );
974
+ }
962
975
  }
963
976
  }
964
977
 
@@ -1089,7 +1102,7 @@ AutoFill.actions = {
1089
1102
  * @static
1090
1103
  * @type String
1091
1104
  */
1092
- AutoFill.version = '2.3.1';
1105
+ AutoFill.version = '2.3.4';
1093
1106
 
1094
1107
 
1095
1108
  /**
@@ -46,7 +46,7 @@ $.extend( true, DataTable.Buttons.defaults, {
46
46
  },
47
47
  collection: {
48
48
  tag: 'ul',
49
- className: 'dt-button-collection dropdown-menu',
49
+ className: 'dropdown-menu',
50
50
  button: {
51
51
  tag: 'li',
52
52
  className: 'dt-button',
@@ -38,14 +38,14 @@ var DataTable = $.fn.dataTable;
38
38
  $.extend( true, DataTable.Buttons.defaults, {
39
39
  dom: {
40
40
  container: {
41
- className: 'dt-buttons btn-group'
41
+ className: 'dt-buttons btn-group flex-wrap'
42
42
  },
43
43
  button: {
44
44
  className: 'btn btn-secondary'
45
45
  },
46
46
  collection: {
47
47
  tag: 'div',
48
- className: 'dt-button-collection dropdown-menu',
48
+ className: 'dropdown-menu',
49
49
  button: {
50
50
  tag: 'a',
51
51
  className: 'dt-button dropdown-item',
@@ -53,10 +53,16 @@ $.extend( true, DataTable.Buttons.defaults, {
53
53
  disabled: 'disabled'
54
54
  }
55
55
  }
56
+ },
57
+ buttonCreated: function ( config, button ) {
58
+ return config.buttons ?
59
+ $('<div class="btn-group"/>').append(button) :
60
+ button;
56
61
  }
57
62
  } );
58
63
 
59
64
  DataTable.ext.buttons.collection.className += ' dropdown-toggle';
65
+ DataTable.ext.buttons.collection.rightAlignClassName = 'dropdown-menu-right';
60
66
 
61
67
  return DataTable.Buttons;
62
68
  }));
@@ -108,6 +108,7 @@ $.extend( DataTable.ext.buttons, {
108
108
  },
109
109
  init: function ( dt, button, conf ) {
110
110
  var that = this;
111
+ button.attr( 'data-cv-idx', conf.columns );
111
112
 
112
113
  dt
113
114
  .on( 'column-visibility.dt'+conf.namespace, function (e, settings) {
@@ -116,13 +117,15 @@ $.extend( DataTable.ext.buttons, {
116
117
  }
117
118
  } )
118
119
  .on( 'column-reorder.dt'+conf.namespace, function (e, settings, details) {
119
- // Don't rename buttons based on column name if the button
120
- // controls more than one column!
121
120
  if ( dt.columns( conf.columns ).count() !== 1 ) {
122
121
  return;
123
122
  }
124
123
 
125
- that.text( conf._columnText( dt, conf ) );
124
+ // This button controls the same column index but the text for the column has
125
+ // changed
126
+ button.text( conf._columnText( dt, conf ) );
127
+
128
+ // Since its a different column, we need to check its visibility
126
129
  that.active( dt.column( conf.columns ).visible() );
127
130
  } );
128
131
 
@@ -42,11 +42,11 @@ var DataTable = $.fn.dataTable;
42
42
  var collection = DataTable.ext.foundationVersion === 6 ?
43
43
  {
44
44
  tag: 'div',
45
- className: 'dt-button-collection dropdown-pane is-open button-group stacked'
45
+ className: 'dropdown-pane is-open button-group stacked'
46
46
  } :
47
47
  {
48
48
  tag: 'ul',
49
- className: 'dt-button-collection f-dropdown open dropdown-pane is-open',
49
+ className: 'f-dropdown open dropdown-pane is-open',
50
50
  button: {
51
51
  tag: 'li',
52
52
  className: 'small',
@@ -70,7 +70,8 @@ $.extend( true, DataTable.Buttons.defaults, {
70
70
  },
71
71
  button: {
72
72
  tag: 'a',
73
- className: 'button small'
73
+ className: 'button small',
74
+ active: 'secondary'
74
75
  },
75
76
  buttonLiner: {
76
77
  tag: null
@@ -80,7 +81,7 @@ $.extend( true, DataTable.Buttons.defaults, {
80
81
  } );
81
82
 
82
83
 
83
- DataTable.ext.buttons.collection.className = 'buttons-collection dropdown';
84
+ DataTable.ext.buttons.collection.className = 'dropdown';
84
85
 
85
86
 
86
87
  return DataTable.Buttons;
@@ -48,6 +48,20 @@ function _pdfMake () {
48
48
  return pdfmake || window.pdfMake;
49
49
  }
50
50
 
51
+ DataTable.Buttons.pdfMake = function (_) {
52
+ if ( ! _ ) {
53
+ return _pdfMake();
54
+ }
55
+ pdfmake = m_ake;
56
+ }
57
+
58
+ DataTable.Buttons.jszip = function (_) {
59
+ if ( ! _ ) {
60
+ return _jsZip();
61
+ }
62
+ jszip = _;
63
+ }
64
+
51
65
 
52
66
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
53
67
  * FileSaver.js dependency
@@ -422,6 +436,9 @@ function _addToZip( zip, obj ) {
422
436
 
423
437
  // Return namespace attributes to being as such
424
438
  str = str.replace( /_dt_b_namespace_token_/g, ':' );
439
+
440
+ // Remove testing name space that IE puts into the space preserve attr
441
+ str = str.replace( /xmlns:NS[\d]+="" NS[\d]+:/g, '' );
425
442
  }
426
443
 
427
444
  // Safari, IE and Edge will put empty name space attributes onto
@@ -505,11 +522,11 @@ function _excelColWidth( data, col ) {
505
522
 
506
523
  // Max width rather than having potentially massive column widths
507
524
  if ( max > 40 ) {
508
- return 52; // 40 * 1.3
525
+ return 54; // 40 * 1.35
509
526
  }
510
527
  }
511
528
 
512
- max *= 1.3;
529
+ max *= 1.35;
513
530
 
514
531
  // And a min width
515
532
  return max > 6 ? max : 6;
@@ -550,8 +567,9 @@ var excelStrings = {
550
567
  '<workbookView xWindow="0" yWindow="0" windowWidth="25600" windowHeight="19020" tabRatio="500"/>'+
551
568
  '</bookViews>'+
552
569
  '<sheets>'+
553
- '<sheet name="" sheetId="1" r:id="rId1"/>'+
570
+ '<sheet name="Sheet1" sheetId="1" r:id="rId1"/>'+
554
571
  '</sheets>'+
572
+ '<definedNames/>'+
555
573
  '</workbook>',
556
574
 
557
575
  "xl/worksheets/sheet1.xml":
@@ -992,6 +1010,7 @@ DataTable.ext.buttons.excelHtml5 = {
992
1010
 
993
1011
  var that = this;
994
1012
  var rowPos = 0;
1013
+ var dataStartRow, dataEndRow;
995
1014
  var getXml = function ( type ) {
996
1015
  var str = excelStrings[ type ];
997
1016
 
@@ -1124,8 +1143,6 @@ DataTable.ext.buttons.excelHtml5 = {
1124
1143
  rowPos++;
1125
1144
  };
1126
1145
 
1127
- $( 'sheets sheet', xlsx.xl['workbook.xml'] ).attr( 'name', _sheetname( config ) );
1128
-
1129
1146
  if ( config.customizeData ) {
1130
1147
  config.customizeData( data );
1131
1148
  }
@@ -1154,15 +1171,20 @@ DataTable.ext.buttons.excelHtml5 = {
1154
1171
  mergeCells( rowPos, data.header.length-1 );
1155
1172
  }
1156
1173
 
1174
+
1157
1175
  // Table itself
1158
1176
  if ( config.header ) {
1159
1177
  addRow( data.header, rowPos );
1160
1178
  $('row:last c', rels).attr( 's', '2' ); // bold
1161
1179
  }
1180
+
1181
+ dataStartRow = rowPos;
1162
1182
 
1163
1183
  for ( var n=0, ie=data.body.length ; n<ie ; n++ ) {
1164
1184
  addRow( data.body[n], rowPos );
1165
1185
  }
1186
+
1187
+ dataEndRow = rowPos;
1166
1188
 
1167
1189
  if ( config.footer && data.footer ) {
1168
1190
  addRow( data.footer, rowPos);
@@ -1190,6 +1212,29 @@ DataTable.ext.buttons.excelHtml5 = {
1190
1212
  } ) );
1191
1213
  }
1192
1214
 
1215
+ // Workbook modifications
1216
+ var workbook = xlsx.xl['workbook.xml'];
1217
+
1218
+ $( 'sheets sheet', workbook ).attr( 'name', _sheetname( config ) );
1219
+
1220
+ // Auto filter for columns
1221
+ if ( config.autoFilter ) {
1222
+ $('mergeCells', rels).before( _createNode( rels, 'autoFilter', {
1223
+ attr: {
1224
+ ref: 'A'+dataStartRow+':'+createCellPos(data.header.length-1)+dataEndRow
1225
+ }
1226
+ } ) );
1227
+
1228
+ $('definedNames', workbook).append( _createNode( workbook, 'definedName', {
1229
+ attr: {
1230
+ name: '_xlnm._FilterDatabase',
1231
+ localSheetId: '0',
1232
+ hidden: 1
1233
+ },
1234
+ text: _sheetname(config)+'!$A$'+dataStartRow+':'+createCellPos(data.header.length-1)+dataEndRow
1235
+ } ) );
1236
+ }
1237
+
1193
1238
  // Let the developer customise the document if they want to
1194
1239
  if ( config.customize ) {
1195
1240
  config.customize( xlsx, config, dt );
@@ -1244,7 +1289,11 @@ DataTable.ext.buttons.excelHtml5 = {
1244
1289
 
1245
1290
  messageBottom: '*',
1246
1291
 
1247
- createEmptyCells: false
1292
+ createEmptyCells: false,
1293
+
1294
+ autoFilter: false,
1295
+
1296
+ sheetName: ''
1248
1297
  };
1249
1298
 
1250
1299
  //
@@ -1280,6 +1329,9 @@ DataTable.ext.buttons.pdfHtml5 = {
1280
1329
 
1281
1330
  for ( var i=0, ien=data.body.length ; i<ien ; i++ ) {
1282
1331
  rows.push( $.map( data.body[i], function ( d ) {
1332
+ if ( d === null || d === undefined ) {
1333
+ d = '';
1334
+ }
1283
1335
  return {
1284
1336
  text: typeof d === 'string' ? d : d+'',
1285
1337
  style: i % 2 ? 'tableBodyEven' : 'tableBodyOdd'