datatables.net 2.2.1 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Readme.md CHANGED
@@ -1,6 +1,6 @@
1
- # DataTables for jQuery
1
+ # DataTables
2
2
 
3
- This package contains distribution files for the [DataTables library](https://datatables.net) for [jQuery](http://jquery.com/). Only the core software for this library is contained in this package - to be correctly styled, a styling package for DataTables must also be included. Styling options include DataTable's native styling, [Bootstrap](http://getbootstrap.com) and [Foundation](http://foundation.zurb.com/).
3
+ This package contains distribution files for the [DataTables table enhancement library](https://datatables.net). Only the core software for this library is contained in this package - to be correctly styled, a styling package for DataTables must also be included (e.g. default, Bootstrap, Bulma, Foundation or others) - please see the [npm installation documentation on the DataTables site](https://datatables.net/manual/installation#Node.js-/-NPM) for full details.
4
4
 
5
5
  DataTables is a table enhancing library which adds features such as paging, ordering, search, scrolling and many more to a static HTML page. A comprehensive API is also available that can be used to manipulate the table. Please refer to the [DataTables web-site](//datatables.net) for a full range of documentation and examples.
6
6
 
@@ -9,29 +9,34 @@ DataTables is a table enhancing library which adds features such as paging, orde
9
9
 
10
10
  ### Browser
11
11
 
12
- For inclusion of this library using a standard `<script>` tag, rather than using this package, it is recommended that you use the [DataTables download builder](//datatables.net/download) which can create CDN or locally hosted packages \for you, will all dependencies satisfied.
12
+ To use DataTables with a simple `<script>` tag, rather than using this package, it is recommended that you use the [DataTables download builder](//datatables.net/download) which can create CDN or locally hosted packages for you, will all dependencies satisfied.
13
13
 
14
14
  ### npm
15
15
 
16
+ For installation via npm, yarn and other similar package managers, install this package with your package manager - e.g.:
17
+
16
18
  ```
17
19
  npm install datatables.net
18
20
  ```
19
21
 
20
- ES3 Syntax
21
- ```
22
- var $ = require( 'jquery' );
23
- require( 'datatables.net' )( window, $ );
24
- ```
22
+ Then, to load and initialise DataTables in your code use:
25
23
 
26
- ES6 Syntax
27
24
  ```
28
- import 'datatables.net'
25
+ import DataTable from 'datatables.net';
26
+
27
+ new DataTable('#myTable', {
28
+ // initalisation options
29
+ });
29
30
  ```
30
31
 
31
- ### bower
32
+ If you are using an old version of Node or a CommonJS loader, you might need to use the `require` syntax:
32
33
 
33
34
  ```
34
- bower install --save datatables.net
35
+ const DataTable = require('datatables.net');
36
+
37
+ new DataTable('#myTable', {
38
+ // initalisation options
39
+ });
35
40
  ```
36
41
 
37
42
 
@@ -45,7 +50,6 @@ Full documentation of the DataTables options, API and plug-in interface are avai
45
50
 
46
51
  Support for DataTables is available through the [DataTables forums](//datatables.net/forums) and [commercial support options](//datatables.net/support) are available.
47
52
 
48
-
49
53
  ### Contributing
50
54
 
51
55
  If you are thinking of contributing code to DataTables, first of all, thank you! All fixes, patches and enhancements to DataTables are very warmly welcomed. This repository is a distribution repo, so patches and issues sent to this repo will not be accepted. Instead, please direct pull requests to the [DataTables/DataTablesSrc](http://github.com/DataTables/DataTablesSrc). For issues / bugs, please direct your questions to the [DataTables forums](//datatables.net/forums).
package/js/dataTables.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! DataTables 2.2.1
1
+ /*! DataTables 2.2.2
2
2
  * © SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
@@ -5544,6 +5544,15 @@
5544
5544
  // This flag allows the above to be satisfied.
5545
5545
  var first = $(settings.nTableWrapper).is(':visible');
5546
5546
 
5547
+ // Use an empty div to attach the observer so it isn't impacted by height changes
5548
+ var resizer = $('<div>')
5549
+ .css({
5550
+ width: '100%',
5551
+ height: 0
5552
+ })
5553
+ .addClass('dt-autosize')
5554
+ .appendTo(settings.nTableWrapper);
5555
+
5547
5556
  settings.resizeObserver = new ResizeObserver(function (e) {
5548
5557
  if (first) {
5549
5558
  first = false;
@@ -5553,7 +5562,7 @@
5553
5562
  }
5554
5563
  });
5555
5564
 
5556
- settings.resizeObserver.observe(settings.nTableWrapper);
5565
+ settings.resizeObserver.observe(resizer[0]);
5557
5566
  }
5558
5567
  else {
5559
5568
  // For old browsers, the best we can do is listen for a window resize
@@ -5885,10 +5894,14 @@
5885
5894
  displayMaster = oSettings.aiDisplayMaster,
5886
5895
  aSort;
5887
5896
 
5897
+ // Make sure the columns all have types defined
5898
+ _fnColumnTypes(oSettings);
5899
+
5888
5900
  // Allow a specific column to be sorted, which will _not_ alter the display
5889
5901
  // master
5890
5902
  if (col !== undefined) {
5891
5903
  var srcCol = oSettings.aoColumns[col];
5904
+
5892
5905
  aSort = [{
5893
5906
  src: col,
5894
5907
  col: col,
@@ -9832,12 +9845,14 @@
9832
9845
  // Function to run either once the table becomes ready or
9833
9846
  // immediately if it is already ready.
9834
9847
  return this.tables().every(function () {
9848
+ var api = this;
9849
+
9835
9850
  if (this.context[0]._bInitComplete) {
9836
- fn.call(this);
9851
+ fn.call(api);
9837
9852
  }
9838
9853
  else {
9839
9854
  this.on('init.dt.DT', function () {
9840
- fn.call(this);
9855
+ fn.call(api);
9841
9856
  });
9842
9857
  }
9843
9858
  } );
@@ -9893,20 +9908,37 @@
9893
9908
  jqTable.append( tfoot );
9894
9909
  }
9895
9910
 
9911
+ // Clean up the header
9912
+ $(thead).find('span.dt-column-order').remove();
9913
+ $(thead).find('span.dt-column-title').each(function () {
9914
+ var title = $(this).html();
9915
+ $(this).parent().append(title);
9916
+ $(this).remove();
9917
+ });
9918
+
9896
9919
  settings.colgroup.remove();
9897
9920
 
9898
9921
  settings.aaSorting = [];
9899
9922
  settings.aaSortingFixed = [];
9900
9923
  _fnSortingClasses( settings );
9901
9924
 
9925
+ $(jqTable).find('th, td').removeClass(
9926
+ $.map(DataTable.ext.type.className, function (v) {
9927
+ return v;
9928
+ }).join(' ')
9929
+ );
9930
+
9902
9931
  $('th, td', thead)
9903
9932
  .removeClass(
9933
+ orderClasses.none + ' ' +
9904
9934
  orderClasses.canAsc + ' ' +
9905
9935
  orderClasses.canDesc + ' ' +
9906
9936
  orderClasses.isAsc + ' ' +
9907
9937
  orderClasses.isDesc
9908
9938
  )
9909
- .css('width', '');
9939
+ .css('width', '')
9940
+ .removeAttr('data-dt-column')
9941
+ .removeAttr('aria-sort');
9910
9942
 
9911
9943
  // Add the TR elements back into the table in their original order
9912
9944
  jqTbody.children().detach();
@@ -9994,7 +10026,7 @@
9994
10026
  * @type string
9995
10027
  * @default Version number
9996
10028
  */
9997
- DataTable.version = "2.2.1";
10029
+ DataTable.version = "2.2.2";
9998
10030
 
9999
10031
  /**
10000
10032
  * Private data store, containing all of the settings objects that are
@@ -13035,16 +13067,16 @@
13035
13067
  cell.removeAttr('aria-sort');
13036
13068
  }
13037
13069
 
13038
- cell.attr('aria-label', orderable
13039
- ? col.ariaTitle + ctx.api.i18n('oAria.orderable' + ariaType)
13040
- : col.ariaTitle
13041
- );
13042
-
13043
13070
  // Make the headers tab-able for keyboard navigation
13044
13071
  if (orderable) {
13045
13072
  var orderSpan = cell.find('.dt-column-order');
13046
13073
 
13047
- orderSpan.attr('role', 'button');
13074
+ orderSpan
13075
+ .attr('role', 'button')
13076
+ .attr('aria-label', orderable
13077
+ ? col.ariaTitle + ctx.api.i18n('oAria.orderable' + ariaType)
13078
+ : col.ariaTitle
13079
+ );
13048
13080
 
13049
13081
  if (tabIndex !== -1) {
13050
13082
  orderSpan.attr('tabindex', tabIndex);