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
@@ -21,11 +21,12 @@
21
21
  * table.cells( 0, [3,4] ).data().average();
22
22
  */
23
23
 
24
- jQuery.fn.dataTable.Api.register( 'average()', function () {
24
+ jQuery.fn.dataTable.Api.register('average()', function () {
25
25
  var data = this.flatten();
26
- var sum = data.reduce( function ( a, b ) {
27
- return (a*1) + (b*1); // cast values in-case they are strings
28
- }, 0 );
29
-
26
+ var sum = data.reduce(function (a, b) {
27
+ return (a * 1) + (b * 1); // cast values in-case they are strings
28
+ }, 0);
29
+
30
30
  return sum / data.length;
31
- } );
31
+ });
32
+
@@ -36,15 +36,16 @@
36
36
  * } );
37
37
  */
38
38
 
39
- jQuery.fn.dataTable.Api.register( 'sum()', function ( ) {
40
- return this.flatten().reduce( function ( a, b ) {
41
- if ( typeof a === 'string' ) {
39
+ jQuery.fn.dataTable.Api.register('sum()', function () {
40
+ return this.flatten().reduce(function (a, b) {
41
+ if (typeof a === 'string') {
42
42
  a = a.replace(/[^\d.-]/g, '') * 1;
43
43
  }
44
- if ( typeof b === 'string' ) {
44
+ if (typeof b === 'string') {
45
45
  b = b.replace(/[^\d.-]/g, '') * 1;
46
46
  }
47
47
 
48
48
  return a + b;
49
- }, 0 );
50
- } );
49
+ }, 0);
50
+ });
51
+
@@ -0,0 +1,160 @@
1
+ /*
2
+ * This plug-in adds another pagination option similar to `full_numbers`, except
3
+ * it adds ellipses around the page numbers when applicable. You can set how
4
+ * many page numbers should be displayed with the iShowPages option.
5
+ *
6
+ * This plug- in extends the oStdClasses object with the following properties:
7
+ * sPageEllipsis, sPageNumber and sPageNumbers.
8
+ *
9
+ * It also extends the oSettings object with the following properties:
10
+ * _iShowPages, _iShowPagesHalf, _iCurrentPage, _iTotalPages, _iFirstPage and
11
+ * _iLastPage.
12
+ *
13
+ * Note that DataTables 1.10 has this ability built in. As such, this plug-ins
14
+ * has been marked as deprecated, but may still be useful for if you are using
15
+ * an old version of DataTables.
16
+ *
17
+ * @name Ellipses
18
+ * @summary Show ellipses in the pagination control where there is a gap in numbers
19
+ * @deprecated
20
+ * @author [Dave Kennedy](http://daveden.wordpress.com/)
21
+ * @example
22
+ * $(document).ready(function() {
23
+ * $('#example').dataTable({
24
+ * 'sPaginationType': 'ellipses'
25
+ * });
26
+ * });
27
+ */
28
+
29
+ $.extend($.fn.dataTableExt.oStdClasses, {
30
+ 'sPageEllipsis': 'paginate_ellipsis',
31
+ 'sPageNumber': 'paginate_number',
32
+ 'sPageNumbers': 'paginate_numbers'
33
+ });
34
+
35
+ $.fn.dataTableExt.oPagination.ellipses = {
36
+ 'oDefaults': {
37
+ 'iShowPages': 5
38
+ },
39
+ 'fnClickHandler': function(e) {
40
+ var fnCallbackDraw = e.data.fnCallbackDraw,
41
+ oSettings = e.data.oSettings,
42
+ sPage = e.data.sPage;
43
+
44
+ if ($(this).is('[disabled]')) {
45
+ return false;
46
+ }
47
+
48
+ oSettings.oApi._fnPageChange(oSettings, sPage);
49
+ fnCallbackDraw(oSettings);
50
+
51
+ return true;
52
+ },
53
+ // fnInit is called once for each instance of pager
54
+ 'fnInit': function(oSettings, nPager, fnCallbackDraw) {
55
+ var oClasses = oSettings.oClasses,
56
+ oLang = oSettings.oLanguage.oPaginate,
57
+ that = this;
58
+
59
+ var iShowPages = oSettings.oInit.iShowPages || this.oDefaults.iShowPages,
60
+ iShowPagesHalf = Math.floor(iShowPages / 2);
61
+
62
+ $.extend(oSettings, {
63
+ _iShowPages: iShowPages,
64
+ _iShowPagesHalf: iShowPagesHalf,
65
+ });
66
+
67
+ var oFirst = $('<a class="' + oClasses.sPageButton + ' ' + oClasses.sPageFirst + '">' + oLang.sFirst + '</a>'),
68
+ oPrevious = $('<a class="' + oClasses.sPageButton + ' ' + oClasses.sPagePrevious + '">' + oLang.sPrevious + '</a>'),
69
+ oNumbers = $('<span class="' + oClasses.sPageNumbers + '"></span>'),
70
+ oNext = $('<a class="' + oClasses.sPageButton + ' ' + oClasses.sPageNext + '">' + oLang.sNext + '</a>'),
71
+ oLast = $('<a class="' + oClasses.sPageButton + ' ' + oClasses.sPageLast + '">' + oLang.sLast + '</a>');
72
+
73
+ oFirst.click({ 'fnCallbackDraw': fnCallbackDraw, 'oSettings': oSettings, 'sPage': 'first' }, that.fnClickHandler);
74
+ oPrevious.click({ 'fnCallbackDraw': fnCallbackDraw, 'oSettings': oSettings, 'sPage': 'previous' }, that.fnClickHandler);
75
+ oNext.click({ 'fnCallbackDraw': fnCallbackDraw, 'oSettings': oSettings, 'sPage': 'next' }, that.fnClickHandler);
76
+ oLast.click({ 'fnCallbackDraw': fnCallbackDraw, 'oSettings': oSettings, 'sPage': 'last' }, that.fnClickHandler);
77
+
78
+ // Draw
79
+ $(nPager).append(oFirst, oPrevious, oNumbers, oNext, oLast);
80
+ },
81
+ // fnUpdate is only called once while table is rendered
82
+ 'fnUpdate': function(oSettings, fnCallbackDraw) {
83
+ var oClasses = oSettings.oClasses,
84
+ that = this;
85
+
86
+ var tableWrapper = oSettings.nTableWrapper;
87
+
88
+ // Update stateful properties
89
+ this.fnUpdateState(oSettings);
90
+
91
+ if (oSettings._iCurrentPage === 1) {
92
+ $('.' + oClasses.sPageFirst, tableWrapper).attr('disabled', true);
93
+ $('.' + oClasses.sPagePrevious, tableWrapper).attr('disabled', true);
94
+ } else {
95
+ $('.' + oClasses.sPageFirst, tableWrapper).removeAttr('disabled');
96
+ $('.' + oClasses.sPagePrevious, tableWrapper).removeAttr('disabled');
97
+ }
98
+
99
+ if (oSettings._iTotalPages === 0 || oSettings._iCurrentPage === oSettings._iTotalPages) {
100
+ $('.' + oClasses.sPageNext, tableWrapper).attr('disabled', true);
101
+ $('.' + oClasses.sPageLast, tableWrapper).attr('disabled', true);
102
+ } else {
103
+ $('.' + oClasses.sPageNext, tableWrapper).removeAttr('disabled');
104
+ $('.' + oClasses.sPageLast, tableWrapper).removeAttr('disabled');
105
+ }
106
+
107
+ var i, oNumber, oNumbers = $('.' + oClasses.sPageNumbers, tableWrapper);
108
+
109
+ // Erase
110
+ oNumbers.html('');
111
+
112
+ for (i = oSettings._iFirstPage; i <= oSettings._iLastPage; i++) {
113
+ oNumber = $('<a class="' + oClasses.sPageButton + ' ' + oClasses.sPageNumber + '">' + oSettings.fnFormatNumber(i) + '</a>');
114
+
115
+ if (oSettings._iCurrentPage === i) {
116
+ oNumber.attr('active', true).attr('disabled', true);
117
+ } else {
118
+ oNumber.click({ 'fnCallbackDraw': fnCallbackDraw, 'oSettings': oSettings, 'sPage': i - 1 }, that.fnClickHandler);
119
+ }
120
+
121
+ // Draw
122
+ oNumbers.append(oNumber);
123
+ }
124
+
125
+ // Add ellipses
126
+ if (1 < oSettings._iFirstPage) {
127
+ oNumbers.prepend('<span class="' + oClasses.sPageEllipsis + '">...</span>');
128
+ }
129
+
130
+ if (oSettings._iLastPage < oSettings._iTotalPages) {
131
+ oNumbers.append('<span class="' + oClasses.sPageEllipsis + '">...</span>');
132
+ }
133
+ },
134
+ // fnUpdateState used to be part of fnUpdate
135
+ // The reason for moving is so we can access current state info before fnUpdate is called
136
+ 'fnUpdateState': function(oSettings) {
137
+ var iCurrentPage = Math.ceil((oSettings._iDisplayStart + 1) / oSettings._iDisplayLength),
138
+ iTotalPages = Math.ceil(oSettings.fnRecordsDisplay() / oSettings._iDisplayLength),
139
+ iFirstPage = iCurrentPage - oSettings._iShowPagesHalf,
140
+ iLastPage = iCurrentPage + oSettings._iShowPagesHalf;
141
+
142
+ if (iTotalPages < oSettings._iShowPages) {
143
+ iFirstPage = 1;
144
+ iLastPage = iTotalPages;
145
+ } else if (iFirstPage < 1) {
146
+ iFirstPage = 1;
147
+ iLastPage = oSettings._iShowPages;
148
+ } else if (iLastPage > iTotalPages) {
149
+ iFirstPage = (iTotalPages - oSettings._iShowPages) + 1;
150
+ iLastPage = iTotalPages;
151
+ }
152
+
153
+ $.extend(oSettings, {
154
+ _iCurrentPage: iCurrentPage,
155
+ _iTotalPages: iTotalPages,
156
+ _iFirstPage: iFirstPage,
157
+ _iLastPage: iLastPage
158
+ });
159
+ }
160
+ };
@@ -0,0 +1,137 @@
1
+ /**
2
+ * This pagination plug-in provides pagination controls for DataTables which
3
+ * match the style and interaction of the ExtJS library's grid component.
4
+ *
5
+ * @name ExtJS style
6
+ * @summary Pagination in the styling of ExtJS
7
+ * @author [Zach Curtis](http://zachariahtimothy.wordpress.com/)
8
+ *
9
+ * @example
10
+ * $(document).ready(function() {
11
+ * $('#example').dataTable( {
12
+ * "sPaginationType": "extStyle"
13
+ * } );
14
+ * } );
15
+ */
16
+
17
+ $.fn.dataTableExt.oApi.fnExtStylePagingInfo = function ( oSettings )
18
+ {
19
+ return {
20
+ "iStart": oSettings._iDisplayStart,
21
+ "iEnd": oSettings.fnDisplayEnd(),
22
+ "iLength": oSettings._iDisplayLength,
23
+ "iTotal": oSettings.fnRecordsTotal(),
24
+ "iFilteredTotal": oSettings.fnRecordsDisplay(),
25
+ "iPage": oSettings._iDisplayLength === -1 ?
26
+ 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
27
+ "iTotalPages": oSettings._iDisplayLength === -1 ?
28
+ 0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
29
+ };
30
+ };
31
+
32
+ $.fn.dataTableExt.oPagination.extStyle = {
33
+
34
+
35
+ "fnInit": function (oSettings, nPaging, fnCallbackDraw) {
36
+
37
+ var oPaging = oSettings.oInstance.fnExtStylePagingInfo();
38
+
39
+ nFirst = $('<span/>', { 'class': 'paginate_button first' , text : "<<" });
40
+ nPrevious = $('<span/>', { 'class': 'paginate_button previous' , text : "<" });
41
+ nNext = $('<span/>', { 'class': 'paginate_button next' , text : ">" });
42
+ nLast = $('<span/>', { 'class': 'paginate_button last' , text : ">>" });
43
+ nPageTxt = $("<span />", { text: 'Page' });
44
+ nPageNumBox = $('<input />', { type: 'text', val: 1, 'class': 'pageinate_input_box' });
45
+ nPageOf = $('<span />', { text: '/' });
46
+ nTotalPages = $('<span />', { class : "paginate_total" , text : oPaging.iTotalPages });
47
+
48
+
49
+ $(nPaging)
50
+ .append(nFirst)
51
+ .append(nPrevious)
52
+ .append(nPageTxt)
53
+ .append(nPageNumBox)
54
+ .append(nPageOf)
55
+ .append(nTotalPages)
56
+ .append(nNext)
57
+ .append(nLast);
58
+
59
+ nFirst.click(function () {
60
+ if( $(this).hasClass("disabled") )
61
+ return;
62
+ oSettings.oApi._fnPageChange(oSettings, "first");
63
+ fnCallbackDraw(oSettings);
64
+ }).bind('selectstart', function () { return false; });
65
+
66
+ nPrevious.click(function () {
67
+ if( $(this).hasClass("disabled") )
68
+ return;
69
+ oSettings.oApi._fnPageChange(oSettings, "previous");
70
+ fnCallbackDraw(oSettings);
71
+ }).bind('selectstart', function () { return false; });
72
+
73
+ nNext.click(function () {
74
+ if( $(this).hasClass("disabled") )
75
+ return;
76
+ oSettings.oApi._fnPageChange(oSettings, "next");
77
+ fnCallbackDraw(oSettings);
78
+ }).bind('selectstart', function () { return false; });
79
+
80
+ nLast.click(function () {
81
+ if( $(this).hasClass("disabled") )
82
+ return;
83
+ oSettings.oApi._fnPageChange(oSettings, "last");
84
+ fnCallbackDraw(oSettings);
85
+ }).bind('selectstart', function () { return false; });
86
+
87
+ nPageNumBox.change(function () {
88
+ var pageValue = parseInt($(this).val(), 10) - 1 ; // -1 because pages are 0 indexed, but the UI is 1
89
+ var oPaging = oSettings.oInstance.fnPagingInfo();
90
+
91
+ if(pageValue === NaN || pageValue<0 ){
92
+ pageValue = 0;
93
+ }else if(pageValue >= oPaging.iTotalPages ){
94
+ pageValue = oPaging.iTotalPages -1;
95
+ }
96
+ oSettings.oApi._fnPageChange(oSettings, pageValue);
97
+ fnCallbackDraw(oSettings);
98
+ });
99
+
100
+ },
101
+
102
+
103
+ "fnUpdate": function (oSettings, fnCallbackDraw) {
104
+ if (!oSettings.aanFeatures.p) {
105
+ return;
106
+ }
107
+
108
+ var oPaging = oSettings.oInstance.fnExtStylePagingInfo();
109
+
110
+ /* Loop over each instance of the pager */
111
+ var an = oSettings.aanFeatures.p;
112
+
113
+ $(an).find('span.paginate_total').html(oPaging.iTotalPages);
114
+ $(an).find('.pageinate_input_box').val(oPaging.iPage+1);
115
+
116
+ $(an).each(function(index,item) {
117
+
118
+ var $item = $(item);
119
+
120
+ if (oPaging.iPage == 0) {
121
+ var prev = $item.find('span.paginate_button.first').add($item.find('span.paginate_button.previous'));
122
+ prev.addClass("disabled");
123
+ }else {
124
+ var prev = $item.find('span.paginate_button.first').add($item.find('span.paginate_button.previous'));
125
+ prev.removeClass("disabled");
126
+ }
127
+
128
+ if (oPaging.iPage+1 == oPaging.iTotalPages) {
129
+ var next = $item.find('span.paginate_button.last').add($item.find('span.paginate_button.next'));
130
+ next.addClass("disabled");
131
+ }else {
132
+ var next = $item.find('span.paginate_button.last').add($item.find('span.paginate_button.next'));
133
+ next.removeClass("disabled");
134
+ }
135
+ });
136
+ }
137
+ };
@@ -0,0 +1,110 @@
1
+ /**
2
+ * The built-in pagination functions provide either two buttons (forward / back)
3
+ * or lots of buttons (forward, back, first, last and individual pages). This
4
+ * plug-in meets the two in the middle providing navigation controls for
5
+ * forward, back, first and last.
6
+ *
7
+ * DataTables has this ability built in using the `dt-string full` option of
8
+ * the `dt-init pagingType` initialisation option. As such, this plug-in is
9
+ * marked as deprecated.
10
+ *
11
+ * @name Four button navigation
12
+ * @summary Display forward, back, first and last buttons.
13
+ * @deprecated
14
+ * @author [Allan Jardine](http://sprymedia.co.uk)
15
+ *
16
+ * @example
17
+ * $(document).ready(function() {
18
+ * $('#example').dataTable( {
19
+ * "sPaginationType": "four_button"
20
+ * } );
21
+ * } );
22
+ */
23
+
24
+ $.fn.dataTableExt.oPagination.four_button = {
25
+ "fnInit": function ( oSettings, nPaging, fnCallbackDraw )
26
+ {
27
+ var nFirst = document.createElement( 'span' );
28
+ var nPrevious = document.createElement( 'span' );
29
+ var nNext = document.createElement( 'span' );
30
+ var nLast = document.createElement( 'span' );
31
+
32
+ nFirst.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sFirst ) );
33
+ nPrevious.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sPrevious ) );
34
+ nNext.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sNext ) );
35
+ nLast.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sLast ) );
36
+
37
+ nFirst.className = "paginate_button first";
38
+ nPrevious.className = "paginate_button previous";
39
+ nNext.className="paginate_button next";
40
+ nLast.className = "paginate_button last";
41
+
42
+ nPaging.appendChild( nFirst );
43
+ nPaging.appendChild( nPrevious );
44
+ nPaging.appendChild( nNext );
45
+ nPaging.appendChild( nLast );
46
+
47
+ $(nFirst).click( function () {
48
+ oSettings.oApi._fnPageChange( oSettings, "first" );
49
+ fnCallbackDraw( oSettings );
50
+ } );
51
+
52
+ $(nPrevious).click( function() {
53
+ oSettings.oApi._fnPageChange( oSettings, "previous" );
54
+ fnCallbackDraw( oSettings );
55
+ } );
56
+
57
+ $(nNext).click( function() {
58
+ oSettings.oApi._fnPageChange( oSettings, "next" );
59
+ fnCallbackDraw( oSettings );
60
+ } );
61
+
62
+ $(nLast).click( function() {
63
+ oSettings.oApi._fnPageChange( oSettings, "last" );
64
+ fnCallbackDraw( oSettings );
65
+ } );
66
+
67
+ /* Disallow text selection */
68
+ $(nFirst).bind( 'selectstart', function () { return false; } );
69
+ $(nPrevious).bind( 'selectstart', function () { return false; } );
70
+ $(nNext).bind( 'selectstart', function () { return false; } );
71
+ $(nLast).bind( 'selectstart', function () { return false; } );
72
+ },
73
+
74
+
75
+ "fnUpdate": function ( oSettings, fnCallbackDraw )
76
+ {
77
+ if ( !oSettings.aanFeatures.p )
78
+ {
79
+ return;
80
+ }
81
+
82
+ /* Loop over each instance of the pager */
83
+ var an = oSettings.aanFeatures.p;
84
+ for ( var i=0, iLen=an.length ; i<iLen ; i++ )
85
+ {
86
+ var buttons = an[i].getElementsByTagName('span');
87
+ if ( oSettings._iDisplayStart === 0 )
88
+ {
89
+ buttons[0].className = "paginate_disabled_previous";
90
+ buttons[1].className = "paginate_disabled_previous";
91
+ }
92
+ else
93
+ {
94
+ buttons[0].className = "paginate_enabled_previous";
95
+ buttons[1].className = "paginate_enabled_previous";
96
+ }
97
+
98
+ if ( oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay() )
99
+ {
100
+ buttons[2].className = "paginate_disabled_next";
101
+ buttons[3].className = "paginate_disabled_next";
102
+ }
103
+ else
104
+ {
105
+ buttons[2].className = "paginate_enabled_next";
106
+ buttons[3].className = "paginate_enabled_next";
107
+ }
108
+ }
109
+ }
110
+ };