jquery-datatables 1.10.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +27 -0
- data/README.md +118 -0
- data/Rakefile +166 -0
- data/app/assets/images/datatables/sort_asc.png +0 -0
- data/app/assets/images/datatables/sort_asc_disabled.png +0 -0
- data/app/assets/images/datatables/sort_both.png +0 -0
- data/app/assets/images/datatables/sort_desc.png +0 -0
- data/app/assets/images/datatables/sort_desc_disabled.png +0 -0
- data/app/assets/javascripts/datatables/dataTables.bootstrap.js +182 -0
- data/app/assets/javascripts/datatables/dataTables.bootstrap4.js +184 -0
- data/app/assets/javascripts/datatables/dataTables.foundation.js +174 -0
- data/app/assets/javascripts/datatables/dataTables.jqueryui.js +164 -0
- data/app/assets/javascripts/datatables/dataTables.material.js +191 -0
- data/app/assets/javascripts/datatables/dataTables.semanticui.js +208 -0
- data/app/assets/javascripts/datatables/dataTables.uikit.js +176 -0
- data/app/assets/javascripts/datatables/extensions/AutoFill/autoFill.bootstrap.js +43 -0
- data/app/assets/javascripts/datatables/extensions/AutoFill/autoFill.bootstrap4.js +43 -0
- data/app/assets/javascripts/datatables/extensions/AutoFill/autoFill.foundation.js +43 -0
- data/app/assets/javascripts/datatables/extensions/AutoFill/autoFill.jqueryui.js +43 -0
- data/app/assets/javascripts/datatables/extensions/AutoFill/autoFill.semanticui.js +43 -0
- data/app/assets/javascripts/datatables/extensions/AutoFill/dataTables.autoFill.js +1036 -0
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.bootstrap.js +68 -0
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.bootstrap4.js +60 -0
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.colVis.js +199 -0
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.flash.js +1325 -0
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.foundation.js +85 -0
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.html5.js +1322 -0
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.jqueryui.js +62 -0
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.print.js +172 -0
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.semanticui.js +57 -0
- data/app/assets/javascripts/datatables/extensions/Buttons/dataTables.buttons.js +1634 -0
- data/app/assets/javascripts/datatables/extensions/ColReorder/dataTables.colReorder.js +1335 -0
- data/app/assets/javascripts/datatables/extensions/FixedColumns/dataTables.fixedColumns.js +1623 -0
- data/app/assets/javascripts/datatables/extensions/FixedHeader/dataTables.fixedHeader.js +672 -0
- data/app/assets/javascripts/datatables/extensions/KeyTable/dataTables.keyTable.js +883 -0
- data/app/assets/javascripts/datatables/extensions/Responsive/dataTables.responsive.js +1232 -0
- data/app/assets/javascripts/datatables/extensions/Responsive/responsive.bootstrap.js +81 -0
- data/app/assets/javascripts/datatables/extensions/Responsive/responsive.bootstrap4.js +81 -0
- data/app/assets/javascripts/datatables/extensions/Responsive/responsive.foundation.js +62 -0
- data/app/assets/javascripts/datatables/extensions/Responsive/responsive.jqueryui.js +63 -0
- data/app/assets/javascripts/datatables/extensions/Responsive/responsive.semanticui.js +77 -0
- data/app/assets/javascripts/datatables/extensions/RowReorder/dataTables.rowReorder.js +709 -0
- data/app/assets/javascripts/datatables/extensions/Scroller/dataTables.scroller.js +1349 -0
- data/app/assets/javascripts/datatables/extensions/Select/dataTables.select.js +1109 -0
- data/app/assets/javascripts/datatables/jquery.dataTables.js +15278 -0
- data/app/assets/media/swf/flashExport.swf +0 -0
- data/app/assets/stylesheets/datatables/dataTables.bootstrap.css +185 -0
- data/app/assets/stylesheets/datatables/dataTables.bootstrap4.css +193 -0
- data/app/assets/stylesheets/datatables/dataTables.foundation.css +116 -0
- data/app/assets/stylesheets/datatables/dataTables.jqueryui.css +481 -0
- data/app/assets/stylesheets/datatables/dataTables.material.css +87 -0
- data/app/assets/stylesheets/datatables/dataTables.semanticui.css +103 -0
- data/app/assets/stylesheets/datatables/dataTables.uikit.css +146 -0
- data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.bootstrap.css +81 -0
- data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.bootstrap4.css +81 -0
- data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.dataTables.css +92 -0
- data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.foundation.css +85 -0
- data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.jqueryui.css +85 -0
- data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.semanticui.css +81 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.bootstrap.css +102 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.bootstrap4.css +163 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.dataTables.css +298 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.foundation.css +129 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.jqueryui.css +162 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.semanticui.css +114 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/common.scss +27 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/mixins.scss +89 -0
- data/app/assets/stylesheets/datatables/extensions/ColReorder/colReorder.bootstrap.css +11 -0
- data/app/assets/stylesheets/datatables/extensions/ColReorder/colReorder.bootstrap4.css +11 -0
- data/app/assets/stylesheets/datatables/extensions/ColReorder/colReorder.dataTables.css +11 -0
- data/app/assets/stylesheets/datatables/extensions/ColReorder/colReorder.foundation.css +11 -0
- data/app/assets/stylesheets/datatables/extensions/ColReorder/colReorder.jqueryui.css +11 -0
- data/app/assets/stylesheets/datatables/extensions/ColReorder/colReorder.semanticui.css +11 -0
- data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.bootstrap.css +44 -0
- data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.bootstrap4.css +44 -0
- data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.dataTables.css +18 -0
- data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.foundation.css +27 -0
- data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.jqueryui.css +8 -0
- data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.semanticui.css +16 -0
- data/app/assets/stylesheets/datatables/extensions/FixedHeader/fixedHeader.bootstrap.css +20 -0
- data/app/assets/stylesheets/datatables/extensions/FixedHeader/fixedHeader.bootstrap4.css +20 -0
- data/app/assets/stylesheets/datatables/extensions/FixedHeader/fixedHeader.dataTables.css +19 -0
- data/app/assets/stylesheets/datatables/extensions/FixedHeader/fixedHeader.foundation.css +20 -0
- data/app/assets/stylesheets/datatables/extensions/FixedHeader/fixedHeader.jqueryui.css +15 -0
- data/app/assets/stylesheets/datatables/extensions/FixedHeader/fixedHeader.semanticui.css +14 -0
- data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.bootstrap.css +5 -0
- data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.bootstrap4.css +5 -0
- data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.dataTables.css +5 -0
- data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.foundation.css +5 -0
- data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.jqueryui.css +5 -0
- data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.semanticui.css +5 -0
- data/app/assets/stylesheets/datatables/extensions/Responsive/responsive.bootstrap.css +181 -0
- data/app/assets/stylesheets/datatables/extensions/Responsive/responsive.bootstrap4.css +181 -0
- data/app/assets/stylesheets/datatables/extensions/Responsive/responsive.dataTables.css +178 -0
- data/app/assets/stylesheets/datatables/extensions/Responsive/responsive.foundation.css +181 -0
- data/app/assets/stylesheets/datatables/extensions/Responsive/responsive.jqueryui.css +178 -0
- data/app/assets/stylesheets/datatables/extensions/Responsive/responsive.semanticui.css +181 -0
- data/app/assets/stylesheets/datatables/extensions/RowReorder/rowReorder.bootstrap.css +22 -0
- data/app/assets/stylesheets/datatables/extensions/RowReorder/rowReorder.bootstrap4.css +22 -0
- data/app/assets/stylesheets/datatables/extensions/RowReorder/rowReorder.dataTables.css +22 -0
- data/app/assets/stylesheets/datatables/extensions/RowReorder/rowReorder.foundation.css +22 -0
- data/app/assets/stylesheets/datatables/extensions/RowReorder/rowReorder.jqueryui.css +22 -0
- data/app/assets/stylesheets/datatables/extensions/RowReorder/rowReorder.semanticui.css +22 -0
- data/app/assets/stylesheets/datatables/extensions/RowReorder/semanticui.scss +5 -0
- data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.bootstrap.css +24 -0
- data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.bootstrap4.css +24 -0
- data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.dataTables.css +20 -0
- data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.foundation.css +17 -0
- data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.jqueryui.css +20 -0
- data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.semanticui.css +20 -0
- data/app/assets/stylesheets/datatables/extensions/Select/select.bootstrap.css +110 -0
- data/app/assets/stylesheets/datatables/extensions/Select/select.bootstrap4.css +110 -0
- data/app/assets/stylesheets/datatables/extensions/Select/select.dataTables.css +100 -0
- data/app/assets/stylesheets/datatables/extensions/Select/select.foundation.css +112 -0
- data/app/assets/stylesheets/datatables/extensions/Select/select.jqueryui.css +100 -0
- data/app/assets/stylesheets/datatables/extensions/Select/select.semanticui.css +105 -0
- data/app/assets/stylesheets/datatables/jquery.dataTables.css +452 -0
- data/app/assets/stylesheets/datatables/jquery.dataTables_themeroller.css +416 -0
- data/jquery-datatables.gemspec +27 -0
- data/lib/generators/jquery/datatables/install_generator.rb +63 -0
- data/lib/generators/jquery/datatables/templates/bootstrap.css.tt +15 -0
- data/lib/generators/jquery/datatables/templates/bootstrap.js.tt +22 -0
- data/lib/generators/jquery/datatables/templates/bootstrap4.css.tt +15 -0
- data/lib/generators/jquery/datatables/templates/bootstrap4.js.tt +22 -0
- data/lib/generators/jquery/datatables/templates/foundation.css.tt +15 -0
- data/lib/generators/jquery/datatables/templates/foundation.js.tt +24 -0
- data/lib/generators/jquery/datatables/templates/jqueryui.css.tt +15 -0
- data/lib/generators/jquery/datatables/templates/jqueryui.js.tt +18 -0
- data/lib/generators/jquery/datatables/templates/material.css.tt +15 -0
- data/lib/generators/jquery/datatables/templates/material.js.tt +19 -0
- data/lib/generators/jquery/datatables/templates/regular.css.tt +15 -0
- data/lib/generators/jquery/datatables/templates/regular.js.tt +18 -0
- data/lib/generators/jquery/datatables/templates/semanticui.css.tt +16 -0
- data/lib/generators/jquery/datatables/templates/semanticui.js.tt +22 -0
- data/lib/generators/jquery/datatables/templates/uikit.css.tt +15 -0
- data/lib/generators/jquery/datatables/templates/uikit.js.tt +19 -0
- data/lib/jquery-datatables.rb +26 -0
- data/lib/jquery-datatables/engine.rb +11 -0
- data/lib/jquery-datatables/version.rb +6 -0
- metadata +269 -0
@@ -0,0 +1,184 @@
|
|
1
|
+
/*! DataTables Bootstrap 3 integration
|
2
|
+
* ©2011-2015 SpryMedia Ltd - datatables.net/license
|
3
|
+
*/
|
4
|
+
|
5
|
+
/**
|
6
|
+
* DataTables integration for Bootstrap 3. This requires Bootstrap 3 and
|
7
|
+
* DataTables 1.10 or newer.
|
8
|
+
*
|
9
|
+
* This file sets the defaults and adds options to DataTables to style its
|
10
|
+
* controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap
|
11
|
+
* for further information.
|
12
|
+
*/
|
13
|
+
(function( factory ){
|
14
|
+
if ( typeof define === 'function' && define.amd ) {
|
15
|
+
// AMD
|
16
|
+
define( ['jquery', 'datatables.net'], function ( $ ) {
|
17
|
+
return factory( $, window, document );
|
18
|
+
} );
|
19
|
+
}
|
20
|
+
else if ( typeof exports === 'object' ) {
|
21
|
+
// CommonJS
|
22
|
+
module.exports = function (root, $) {
|
23
|
+
if ( ! root ) {
|
24
|
+
root = window;
|
25
|
+
}
|
26
|
+
|
27
|
+
if ( ! $ || ! $.fn.dataTable ) {
|
28
|
+
// Require DataTables, which attaches to jQuery, including
|
29
|
+
// jQuery if needed and have a $ property so we can access the
|
30
|
+
// jQuery object that is used
|
31
|
+
$ = require('datatables.net')(root, $).$;
|
32
|
+
}
|
33
|
+
|
34
|
+
return factory( $, root, root.document );
|
35
|
+
};
|
36
|
+
}
|
37
|
+
else {
|
38
|
+
// Browser
|
39
|
+
factory( jQuery, window, document );
|
40
|
+
}
|
41
|
+
}(function( $, window, document, undefined ) {
|
42
|
+
'use strict';
|
43
|
+
var DataTable = $.fn.dataTable;
|
44
|
+
|
45
|
+
|
46
|
+
/* Set the defaults for DataTables initialisation */
|
47
|
+
$.extend( true, DataTable.defaults, {
|
48
|
+
dom:
|
49
|
+
"<'row'<'col-md-6'l><'col-md-6'f>>" +
|
50
|
+
"<'row'<'col-md-12'tr>>" +
|
51
|
+
"<'row'<'col-md-5'i><'col-md-7'p>>",
|
52
|
+
renderer: 'bootstrap'
|
53
|
+
} );
|
54
|
+
|
55
|
+
|
56
|
+
/* Default class modification */
|
57
|
+
$.extend( DataTable.ext.classes, {
|
58
|
+
sWrapper: "dataTables_wrapper form-inline dt-bootstrap4",
|
59
|
+
sFilterInput: "form-control input-sm",
|
60
|
+
sLengthSelect: "form-control input-sm",
|
61
|
+
sProcessing: "dataTables_processing panel panel-default",
|
62
|
+
sPageButton: "paginate_button page-item"
|
63
|
+
} );
|
64
|
+
|
65
|
+
|
66
|
+
/* Bootstrap paging button renderer */
|
67
|
+
DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) {
|
68
|
+
var api = new DataTable.Api( settings );
|
69
|
+
var classes = settings.oClasses;
|
70
|
+
var lang = settings.oLanguage.oPaginate;
|
71
|
+
var aria = settings.oLanguage.oAria.paginate || {};
|
72
|
+
var btnDisplay, btnClass, counter=0;
|
73
|
+
|
74
|
+
var attach = function( container, buttons ) {
|
75
|
+
var i, ien, node, button;
|
76
|
+
var clickHandler = function ( e ) {
|
77
|
+
e.preventDefault();
|
78
|
+
if ( !$(e.currentTarget).hasClass('disabled') && api.page() != e.data.action ) {
|
79
|
+
api.page( e.data.action ).draw( 'page' );
|
80
|
+
}
|
81
|
+
};
|
82
|
+
|
83
|
+
for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
|
84
|
+
button = buttons[i];
|
85
|
+
|
86
|
+
if ( $.isArray( button ) ) {
|
87
|
+
attach( container, button );
|
88
|
+
}
|
89
|
+
else {
|
90
|
+
btnDisplay = '';
|
91
|
+
btnClass = '';
|
92
|
+
|
93
|
+
switch ( button ) {
|
94
|
+
case 'ellipsis':
|
95
|
+
btnDisplay = '…';
|
96
|
+
btnClass = 'disabled';
|
97
|
+
break;
|
98
|
+
|
99
|
+
case 'first':
|
100
|
+
btnDisplay = lang.sFirst;
|
101
|
+
btnClass = button + (page > 0 ?
|
102
|
+
'' : ' disabled');
|
103
|
+
break;
|
104
|
+
|
105
|
+
case 'previous':
|
106
|
+
btnDisplay = lang.sPrevious;
|
107
|
+
btnClass = button + (page > 0 ?
|
108
|
+
'' : ' disabled');
|
109
|
+
break;
|
110
|
+
|
111
|
+
case 'next':
|
112
|
+
btnDisplay = lang.sNext;
|
113
|
+
btnClass = button + (page < pages-1 ?
|
114
|
+
'' : ' disabled');
|
115
|
+
break;
|
116
|
+
|
117
|
+
case 'last':
|
118
|
+
btnDisplay = lang.sLast;
|
119
|
+
btnClass = button + (page < pages-1 ?
|
120
|
+
'' : ' disabled');
|
121
|
+
break;
|
122
|
+
|
123
|
+
default:
|
124
|
+
btnDisplay = button + 1;
|
125
|
+
btnClass = page === button ?
|
126
|
+
'active' : '';
|
127
|
+
break;
|
128
|
+
}
|
129
|
+
|
130
|
+
if ( btnDisplay ) {
|
131
|
+
node = $('<li>', {
|
132
|
+
'class': classes.sPageButton+' '+btnClass,
|
133
|
+
'id': idx === 0 && typeof button === 'string' ?
|
134
|
+
settings.sTableId +'_'+ button :
|
135
|
+
null
|
136
|
+
} )
|
137
|
+
.append( $('<a>', {
|
138
|
+
'href': '#',
|
139
|
+
'aria-controls': settings.sTableId,
|
140
|
+
'aria-label': aria[ button ],
|
141
|
+
'data-dt-idx': counter,
|
142
|
+
'tabindex': settings.iTabIndex,
|
143
|
+
'class': 'page-link'
|
144
|
+
} )
|
145
|
+
.html( btnDisplay )
|
146
|
+
)
|
147
|
+
.appendTo( container );
|
148
|
+
|
149
|
+
settings.oApi._fnBindAction(
|
150
|
+
node, {action: button}, clickHandler
|
151
|
+
);
|
152
|
+
|
153
|
+
counter++;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
};
|
158
|
+
|
159
|
+
// IE9 throws an 'unknown error' if document.activeElement is used
|
160
|
+
// inside an iframe or frame.
|
161
|
+
var activeEl;
|
162
|
+
|
163
|
+
try {
|
164
|
+
// Because this approach is destroying and recreating the paging
|
165
|
+
// elements, focus is lost on the select button which is bad for
|
166
|
+
// accessibility. So we want to restore focus once the draw has
|
167
|
+
// completed
|
168
|
+
activeEl = $(host).find(document.activeElement).data('dt-idx');
|
169
|
+
}
|
170
|
+
catch (e) {}
|
171
|
+
|
172
|
+
attach(
|
173
|
+
$(host).empty().html('<ul class="pagination"/>').children('ul'),
|
174
|
+
buttons
|
175
|
+
);
|
176
|
+
|
177
|
+
if ( activeEl ) {
|
178
|
+
$(host).find( '[data-dt-idx='+activeEl+']' ).focus();
|
179
|
+
}
|
180
|
+
};
|
181
|
+
|
182
|
+
|
183
|
+
return DataTable;
|
184
|
+
}));
|
@@ -0,0 +1,174 @@
|
|
1
|
+
/*! DataTables Foundation integration
|
2
|
+
* ©2011-2015 SpryMedia Ltd - datatables.net/license
|
3
|
+
*/
|
4
|
+
|
5
|
+
/**
|
6
|
+
* DataTables integration for Foundation. This requires Foundation 5 and
|
7
|
+
* DataTables 1.10 or newer.
|
8
|
+
*
|
9
|
+
* This file sets the defaults and adds options to DataTables to style its
|
10
|
+
* controls using Foundation. See http://datatables.net/manual/styling/foundation
|
11
|
+
* for further information.
|
12
|
+
*/
|
13
|
+
(function( factory ){
|
14
|
+
if ( typeof define === 'function' && define.amd ) {
|
15
|
+
// AMD
|
16
|
+
define( ['jquery', 'datatables.net'], function ( $ ) {
|
17
|
+
return factory( $, window, document );
|
18
|
+
} );
|
19
|
+
}
|
20
|
+
else if ( typeof exports === 'object' ) {
|
21
|
+
// CommonJS
|
22
|
+
module.exports = function (root, $) {
|
23
|
+
if ( ! root ) {
|
24
|
+
root = window;
|
25
|
+
}
|
26
|
+
|
27
|
+
if ( ! $ || ! $.fn.dataTable ) {
|
28
|
+
$ = require('datatables.net')(root, $).$;
|
29
|
+
}
|
30
|
+
|
31
|
+
return factory( $, root, root.document );
|
32
|
+
};
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
// Browser
|
36
|
+
factory( jQuery, window, document );
|
37
|
+
}
|
38
|
+
}(function( $, window, document, undefined ) {
|
39
|
+
'use strict';
|
40
|
+
var DataTable = $.fn.dataTable;
|
41
|
+
|
42
|
+
// Detect Foundation 5 / 6 as they have different element and class requirements
|
43
|
+
var meta = $('<meta class="foundation-mq"/>').appendTo('head');
|
44
|
+
DataTable.ext.foundationVersion = meta.css('font-family').match(/small|medium|large/) ? 6 : 5;
|
45
|
+
meta.remove();
|
46
|
+
|
47
|
+
|
48
|
+
$.extend( DataTable.ext.classes, {
|
49
|
+
sWrapper: "dataTables_wrapper dt-foundation",
|
50
|
+
sProcessing: "dataTables_processing panel"
|
51
|
+
} );
|
52
|
+
|
53
|
+
|
54
|
+
/* Set the defaults for DataTables initialisation */
|
55
|
+
$.extend( true, DataTable.defaults, {
|
56
|
+
dom:
|
57
|
+
"<'row'<'small-6 columns'l><'small-6 columns'f>r>"+
|
58
|
+
"t"+
|
59
|
+
"<'row'<'small-6 columns'i><'small-6 columns'p>>",
|
60
|
+
renderer: 'foundation'
|
61
|
+
} );
|
62
|
+
|
63
|
+
|
64
|
+
/* Page button renderer */
|
65
|
+
DataTable.ext.renderer.pageButton.foundation = function ( settings, host, idx, buttons, page, pages ) {
|
66
|
+
var api = new DataTable.Api( settings );
|
67
|
+
var classes = settings.oClasses;
|
68
|
+
var lang = settings.oLanguage.oPaginate;
|
69
|
+
var aria = settings.oLanguage.oAria.paginate || {};
|
70
|
+
var btnDisplay, btnClass;
|
71
|
+
var tag;
|
72
|
+
var v5 = DataTable.ext.foundationVersion === 5;
|
73
|
+
|
74
|
+
var attach = function( container, buttons ) {
|
75
|
+
var i, ien, node, button;
|
76
|
+
var clickHandler = function ( e ) {
|
77
|
+
e.preventDefault();
|
78
|
+
if ( !$(e.currentTarget).hasClass('unavailable') && api.page() != e.data.action ) {
|
79
|
+
api.page( e.data.action ).draw( 'page' );
|
80
|
+
}
|
81
|
+
};
|
82
|
+
|
83
|
+
for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
|
84
|
+
button = buttons[i];
|
85
|
+
|
86
|
+
if ( $.isArray( button ) ) {
|
87
|
+
attach( container, button );
|
88
|
+
}
|
89
|
+
else {
|
90
|
+
btnDisplay = '';
|
91
|
+
btnClass = '';
|
92
|
+
tag = null;
|
93
|
+
|
94
|
+
switch ( button ) {
|
95
|
+
case 'ellipsis':
|
96
|
+
btnDisplay = '…';
|
97
|
+
btnClass = 'unavailable disabled';
|
98
|
+
tag = null;
|
99
|
+
break;
|
100
|
+
|
101
|
+
case 'first':
|
102
|
+
btnDisplay = lang.sFirst;
|
103
|
+
btnClass = button + (page > 0 ?
|
104
|
+
'' : ' unavailable disabled');
|
105
|
+
tag = page > 0 ? 'a' : null;
|
106
|
+
break;
|
107
|
+
|
108
|
+
case 'previous':
|
109
|
+
btnDisplay = lang.sPrevious;
|
110
|
+
btnClass = button + (page > 0 ?
|
111
|
+
'' : ' unavailable disabled');
|
112
|
+
tag = page > 0 ? 'a' : null;
|
113
|
+
break;
|
114
|
+
|
115
|
+
case 'next':
|
116
|
+
btnDisplay = lang.sNext;
|
117
|
+
btnClass = button + (page < pages-1 ?
|
118
|
+
'' : ' unavailable disabled');
|
119
|
+
tag = page < pages-1 ? 'a' : null;
|
120
|
+
break;
|
121
|
+
|
122
|
+
case 'last':
|
123
|
+
btnDisplay = lang.sLast;
|
124
|
+
btnClass = button + (page < pages-1 ?
|
125
|
+
'' : ' unavailable disabled');
|
126
|
+
tag = page < pages-1 ? 'a' : null;
|
127
|
+
break;
|
128
|
+
|
129
|
+
default:
|
130
|
+
btnDisplay = button + 1;
|
131
|
+
btnClass = page === button ?
|
132
|
+
'current' : '';
|
133
|
+
tag = page === button ?
|
134
|
+
null : 'a';
|
135
|
+
break;
|
136
|
+
}
|
137
|
+
|
138
|
+
if ( v5 ) {
|
139
|
+
tag = 'a';
|
140
|
+
}
|
141
|
+
|
142
|
+
if ( btnDisplay ) {
|
143
|
+
node = $('<li>', {
|
144
|
+
'class': classes.sPageButton+' '+btnClass,
|
145
|
+
'aria-controls': settings.sTableId,
|
146
|
+
'aria-label': aria[ button ],
|
147
|
+
'tabindex': settings.iTabIndex,
|
148
|
+
'id': idx === 0 && typeof button === 'string' ?
|
149
|
+
settings.sTableId +'_'+ button :
|
150
|
+
null
|
151
|
+
} )
|
152
|
+
.append( tag ?
|
153
|
+
$('<'+tag+'/>', {'href': '#'} ).html( btnDisplay ) :
|
154
|
+
btnDisplay
|
155
|
+
)
|
156
|
+
.appendTo( container );
|
157
|
+
|
158
|
+
settings.oApi._fnBindAction(
|
159
|
+
node, {action: button}, clickHandler
|
160
|
+
);
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
};
|
165
|
+
|
166
|
+
attach(
|
167
|
+
$(host).empty().html('<ul class="pagination"/>').children('ul'),
|
168
|
+
buttons
|
169
|
+
);
|
170
|
+
};
|
171
|
+
|
172
|
+
|
173
|
+
return DataTable;
|
174
|
+
}));
|
@@ -0,0 +1,164 @@
|
|
1
|
+
/*! DataTables jQuery UI integration
|
2
|
+
* ©2011-2014 SpryMedia Ltd - datatables.net/license
|
3
|
+
*/
|
4
|
+
|
5
|
+
/**
|
6
|
+
* DataTables integration for jQuery UI. This requires jQuery UI and
|
7
|
+
* DataTables 1.10 or newer.
|
8
|
+
*
|
9
|
+
* This file sets the defaults and adds options to DataTables to style its
|
10
|
+
* controls using jQuery UI. See http://datatables.net/manual/styling/jqueryui
|
11
|
+
* for further information.
|
12
|
+
*/
|
13
|
+
(function( factory ){
|
14
|
+
if ( typeof define === 'function' && define.amd ) {
|
15
|
+
// AMD
|
16
|
+
define( ['jquery', 'datatables.net'], function ( $ ) {
|
17
|
+
return factory( $, window, document );
|
18
|
+
} );
|
19
|
+
}
|
20
|
+
else if ( typeof exports === 'object' ) {
|
21
|
+
// CommonJS
|
22
|
+
module.exports = function (root, $) {
|
23
|
+
if ( ! root ) {
|
24
|
+
root = window;
|
25
|
+
}
|
26
|
+
|
27
|
+
if ( ! $ || ! $.fn.dataTable ) {
|
28
|
+
$ = require('datatables.net')(root, $).$;
|
29
|
+
}
|
30
|
+
|
31
|
+
return factory( $, root, root.document );
|
32
|
+
};
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
// Browser
|
36
|
+
factory( jQuery, window, document );
|
37
|
+
}
|
38
|
+
}(function( $, window, document, undefined ) {
|
39
|
+
'use strict';
|
40
|
+
var DataTable = $.fn.dataTable;
|
41
|
+
|
42
|
+
|
43
|
+
var sort_prefix = 'css_right ui-icon ui-icon-';
|
44
|
+
var toolbar_prefix = 'fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-';
|
45
|
+
|
46
|
+
/* Set the defaults for DataTables initialisation */
|
47
|
+
$.extend( true, DataTable.defaults, {
|
48
|
+
dom:
|
49
|
+
'<"'+toolbar_prefix+'tl ui-corner-tr"lfr>'+
|
50
|
+
't'+
|
51
|
+
'<"'+toolbar_prefix+'bl ui-corner-br"ip>',
|
52
|
+
renderer: 'jqueryui'
|
53
|
+
} );
|
54
|
+
|
55
|
+
|
56
|
+
$.extend( DataTable.ext.classes, {
|
57
|
+
"sWrapper": "dataTables_wrapper dt-jqueryui",
|
58
|
+
|
59
|
+
/* Full numbers paging buttons */
|
60
|
+
"sPageButton": "fg-button ui-button ui-state-default",
|
61
|
+
"sPageButtonActive": "ui-state-disabled",
|
62
|
+
"sPageButtonDisabled": "ui-state-disabled",
|
63
|
+
|
64
|
+
/* Features */
|
65
|
+
"sPaging": "dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi "+
|
66
|
+
"ui-buttonset-multi paging_", /* Note that the type is postfixed */
|
67
|
+
|
68
|
+
/* Sorting */
|
69
|
+
"sSortAsc": "ui-state-default sorting_asc",
|
70
|
+
"sSortDesc": "ui-state-default sorting_desc",
|
71
|
+
"sSortable": "ui-state-default sorting",
|
72
|
+
"sSortableAsc": "ui-state-default sorting_asc_disabled",
|
73
|
+
"sSortableDesc": "ui-state-default sorting_desc_disabled",
|
74
|
+
"sSortableNone": "ui-state-default sorting_disabled",
|
75
|
+
"sSortIcon": "DataTables_sort_icon",
|
76
|
+
|
77
|
+
/* Scrolling */
|
78
|
+
"sScrollHead": "dataTables_scrollHead "+"ui-state-default",
|
79
|
+
"sScrollFoot": "dataTables_scrollFoot "+"ui-state-default",
|
80
|
+
|
81
|
+
/* Misc */
|
82
|
+
"sHeaderTH": "ui-state-default",
|
83
|
+
"sFooterTH": "ui-state-default"
|
84
|
+
} );
|
85
|
+
|
86
|
+
|
87
|
+
DataTable.ext.renderer.header.jqueryui = function ( settings, cell, column, classes ) {
|
88
|
+
// Calculate what the unsorted class should be
|
89
|
+
var noSortAppliedClass = sort_prefix+'carat-2-n-s';
|
90
|
+
var asc = $.inArray('asc', column.asSorting) !== -1;
|
91
|
+
var desc = $.inArray('desc', column.asSorting) !== -1;
|
92
|
+
|
93
|
+
if ( !column.bSortable || (!asc && !desc) ) {
|
94
|
+
noSortAppliedClass = '';
|
95
|
+
}
|
96
|
+
else if ( asc && !desc ) {
|
97
|
+
noSortAppliedClass = sort_prefix+'carat-1-n';
|
98
|
+
}
|
99
|
+
else if ( !asc && desc ) {
|
100
|
+
noSortAppliedClass = sort_prefix+'carat-1-s';
|
101
|
+
}
|
102
|
+
|
103
|
+
// Setup the DOM structure
|
104
|
+
$('<div/>')
|
105
|
+
.addClass( 'DataTables_sort_wrapper' )
|
106
|
+
.append( cell.contents() )
|
107
|
+
.append( $('<span/>')
|
108
|
+
.addClass( classes.sSortIcon+' '+noSortAppliedClass )
|
109
|
+
)
|
110
|
+
.appendTo( cell );
|
111
|
+
|
112
|
+
// Attach a sort listener to update on sort
|
113
|
+
$(settings.nTable).on( 'order.dt', function ( e, ctx, sorting, columns ) {
|
114
|
+
if ( settings !== ctx ) {
|
115
|
+
return;
|
116
|
+
}
|
117
|
+
|
118
|
+
var colIdx = column.idx;
|
119
|
+
|
120
|
+
cell
|
121
|
+
.removeClass( classes.sSortAsc +" "+classes.sSortDesc )
|
122
|
+
.addClass( columns[ colIdx ] == 'asc' ?
|
123
|
+
classes.sSortAsc : columns[ colIdx ] == 'desc' ?
|
124
|
+
classes.sSortDesc :
|
125
|
+
column.sSortingClass
|
126
|
+
);
|
127
|
+
|
128
|
+
cell
|
129
|
+
.find( 'span.'+classes.sSortIcon )
|
130
|
+
.removeClass(
|
131
|
+
sort_prefix+'triangle-1-n' +" "+
|
132
|
+
sort_prefix+'triangle-1-s' +" "+
|
133
|
+
sort_prefix+'carat-2-n-s' +" "+
|
134
|
+
sort_prefix+'carat-1-n' +" "+
|
135
|
+
sort_prefix+'carat-1-s'
|
136
|
+
)
|
137
|
+
.addClass( columns[ colIdx ] == 'asc' ?
|
138
|
+
sort_prefix+'triangle-1-n' : columns[ colIdx ] == 'desc' ?
|
139
|
+
sort_prefix+'triangle-1-s' :
|
140
|
+
noSortAppliedClass
|
141
|
+
);
|
142
|
+
} );
|
143
|
+
};
|
144
|
+
|
145
|
+
|
146
|
+
/*
|
147
|
+
* TableTools jQuery UI compatibility
|
148
|
+
* Required TableTools 2.1+
|
149
|
+
*/
|
150
|
+
if ( DataTable.TableTools ) {
|
151
|
+
$.extend( true, DataTable.TableTools.classes, {
|
152
|
+
"container": "DTTT_container ui-buttonset ui-buttonset-multi",
|
153
|
+
"buttons": {
|
154
|
+
"normal": "DTTT_button ui-button ui-state-default"
|
155
|
+
},
|
156
|
+
"collection": {
|
157
|
+
"container": "DTTT_collection ui-buttonset ui-buttonset-multi"
|
158
|
+
}
|
159
|
+
} );
|
160
|
+
}
|
161
|
+
|
162
|
+
|
163
|
+
return DataTable;
|
164
|
+
}));
|