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,191 @@
|
|
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
|
+
"<'mdl-grid'"+
|
50
|
+
"<'mdl-cell mdl-cell--6-col'l>"+
|
51
|
+
"<'mdl-cell mdl-cell--6-col'f>"+
|
52
|
+
">"+
|
53
|
+
"<'mdl-grid dt-table'"+
|
54
|
+
"<'mdl-cell mdl-cell--12-col'tr>"+
|
55
|
+
">"+
|
56
|
+
"<'mdl-grid'"+
|
57
|
+
"<'mdl-cell mdl-cell--4-col'i>"+
|
58
|
+
"<'mdl-cell mdl-cell--8-col'p>"+
|
59
|
+
">",
|
60
|
+
renderer: 'material'
|
61
|
+
} );
|
62
|
+
|
63
|
+
|
64
|
+
/* Default class modification */
|
65
|
+
$.extend( DataTable.ext.classes, {
|
66
|
+
sWrapper: "dataTables_wrapper form-inline dt-material",
|
67
|
+
sFilterInput: "form-control input-sm",
|
68
|
+
sLengthSelect: "form-control input-sm",
|
69
|
+
sProcessing: "dataTables_processing panel panel-default"
|
70
|
+
} );
|
71
|
+
|
72
|
+
|
73
|
+
/* Bootstrap paging button renderer */
|
74
|
+
DataTable.ext.renderer.pageButton.material = function ( settings, host, idx, buttons, page, pages ) {
|
75
|
+
var api = new DataTable.Api( settings );
|
76
|
+
var classes = settings.oClasses;
|
77
|
+
var lang = settings.oLanguage.oPaginate;
|
78
|
+
var aria = settings.oLanguage.oAria.paginate || {};
|
79
|
+
var btnDisplay, btnClass, counter=0;
|
80
|
+
|
81
|
+
var attach = function( container, buttons ) {
|
82
|
+
var i, ien, node, button, disabled, active;
|
83
|
+
var clickHandler = function ( e ) {
|
84
|
+
e.preventDefault();
|
85
|
+
if ( !$(e.currentTarget).hasClass('disabled') && api.page() != e.data.action ) {
|
86
|
+
api.page( e.data.action ).draw( 'page' );
|
87
|
+
}
|
88
|
+
};
|
89
|
+
|
90
|
+
for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
|
91
|
+
button = buttons[i];
|
92
|
+
|
93
|
+
if ( $.isArray( button ) ) {
|
94
|
+
attach( container, button );
|
95
|
+
}
|
96
|
+
else {
|
97
|
+
btnDisplay = '';
|
98
|
+
active = false;
|
99
|
+
|
100
|
+
switch ( button ) {
|
101
|
+
case 'ellipsis':
|
102
|
+
btnDisplay = '…';
|
103
|
+
btnClass = 'disabled';
|
104
|
+
break;
|
105
|
+
|
106
|
+
case 'first':
|
107
|
+
btnDisplay = lang.sFirst;
|
108
|
+
btnClass = button + (page > 0 ?
|
109
|
+
'' : ' disabled');
|
110
|
+
break;
|
111
|
+
|
112
|
+
case 'previous':
|
113
|
+
btnDisplay = lang.sPrevious;
|
114
|
+
btnClass = button + (page > 0 ?
|
115
|
+
'' : ' disabled');
|
116
|
+
break;
|
117
|
+
|
118
|
+
case 'next':
|
119
|
+
btnDisplay = lang.sNext;
|
120
|
+
btnClass = button + (page < pages-1 ?
|
121
|
+
'' : ' disabled');
|
122
|
+
break;
|
123
|
+
|
124
|
+
case 'last':
|
125
|
+
btnDisplay = lang.sLast;
|
126
|
+
btnClass = button + (page < pages-1 ?
|
127
|
+
'' : ' disabled');
|
128
|
+
break;
|
129
|
+
|
130
|
+
default:
|
131
|
+
btnDisplay = button + 1;
|
132
|
+
btnClass = '';
|
133
|
+
active = page === button;
|
134
|
+
break;
|
135
|
+
}
|
136
|
+
|
137
|
+
if ( active ) {
|
138
|
+
btnClass += ' mdl-button--raised mdl-button--colored';
|
139
|
+
}
|
140
|
+
|
141
|
+
if ( btnDisplay ) {
|
142
|
+
node = $('<button>', {
|
143
|
+
'class': 'mdl-button '+btnClass,
|
144
|
+
'id': idx === 0 && typeof button === 'string' ?
|
145
|
+
settings.sTableId +'_'+ button :
|
146
|
+
null,
|
147
|
+
'aria-controls': settings.sTableId,
|
148
|
+
'aria-label': aria[ button ],
|
149
|
+
'data-dt-idx': counter,
|
150
|
+
'tabindex': settings.iTabIndex,
|
151
|
+
'disabled': btnClass.indexOf('disabled') !== -1
|
152
|
+
} )
|
153
|
+
.html( btnDisplay )
|
154
|
+
.appendTo( container );
|
155
|
+
|
156
|
+
settings.oApi._fnBindAction(
|
157
|
+
node, {action: button}, clickHandler
|
158
|
+
);
|
159
|
+
|
160
|
+
counter++;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
};
|
165
|
+
|
166
|
+
// IE9 throws an 'unknown error' if document.activeElement is used
|
167
|
+
// inside an iframe or frame.
|
168
|
+
var activeEl;
|
169
|
+
|
170
|
+
try {
|
171
|
+
// Because this approach is destroying and recreating the paging
|
172
|
+
// elements, focus is lost on the select button which is bad for
|
173
|
+
// accessibility. So we want to restore focus once the draw has
|
174
|
+
// completed
|
175
|
+
activeEl = $(host).find(document.activeElement).data('dt-idx');
|
176
|
+
}
|
177
|
+
catch (e) {}
|
178
|
+
|
179
|
+
attach(
|
180
|
+
$(host).empty().html('<div class="pagination"/>').children(),
|
181
|
+
buttons
|
182
|
+
);
|
183
|
+
|
184
|
+
if ( activeEl ) {
|
185
|
+
$(host).find( '[data-dt-idx='+activeEl+']' ).focus();
|
186
|
+
}
|
187
|
+
};
|
188
|
+
|
189
|
+
|
190
|
+
return DataTable;
|
191
|
+
}));
|
@@ -0,0 +1,208 @@
|
|
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
|
+
"<'ui grid'"+
|
50
|
+
"<'row'"+
|
51
|
+
"<'eight wide column'l>"+
|
52
|
+
"<'right aligned eight wide column'f>"+
|
53
|
+
">"+
|
54
|
+
"<'row dt-table'"+
|
55
|
+
"<'sixteen wide column'tr>"+
|
56
|
+
">"+
|
57
|
+
"<'row'"+
|
58
|
+
"<'seven wide column'i>"+
|
59
|
+
"<'right aligned nine wide column'p>"+
|
60
|
+
">"+
|
61
|
+
">",
|
62
|
+
renderer: 'semanticUI'
|
63
|
+
} );
|
64
|
+
|
65
|
+
|
66
|
+
/* Default class modification */
|
67
|
+
$.extend( DataTable.ext.classes, {
|
68
|
+
sWrapper: "dataTables_wrapper dt-semanticUI",
|
69
|
+
sFilter: "dataTables_filter ui input",
|
70
|
+
sProcessing: "dataTables_processing ui segment",
|
71
|
+
sPageButton: "paginate_button item"
|
72
|
+
} );
|
73
|
+
|
74
|
+
|
75
|
+
/* Bootstrap paging button renderer */
|
76
|
+
DataTable.ext.renderer.pageButton.semanticUI = function ( settings, host, idx, buttons, page, pages ) {
|
77
|
+
var api = new DataTable.Api( settings );
|
78
|
+
var classes = settings.oClasses;
|
79
|
+
var lang = settings.oLanguage.oPaginate;
|
80
|
+
var aria = settings.oLanguage.oAria.paginate || {};
|
81
|
+
var btnDisplay, btnClass, counter=0;
|
82
|
+
|
83
|
+
var attach = function( container, buttons ) {
|
84
|
+
var i, ien, node, button;
|
85
|
+
var clickHandler = function ( e ) {
|
86
|
+
e.preventDefault();
|
87
|
+
if ( !$(e.currentTarget).hasClass('disabled') && api.page() != e.data.action ) {
|
88
|
+
api.page( e.data.action ).draw( 'page' );
|
89
|
+
}
|
90
|
+
};
|
91
|
+
|
92
|
+
for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
|
93
|
+
button = buttons[i];
|
94
|
+
|
95
|
+
if ( $.isArray( button ) ) {
|
96
|
+
attach( container, button );
|
97
|
+
}
|
98
|
+
else {
|
99
|
+
btnDisplay = '';
|
100
|
+
btnClass = '';
|
101
|
+
|
102
|
+
switch ( button ) {
|
103
|
+
case 'ellipsis':
|
104
|
+
btnDisplay = '…';
|
105
|
+
btnClass = 'disabled';
|
106
|
+
break;
|
107
|
+
|
108
|
+
case 'first':
|
109
|
+
btnDisplay = lang.sFirst;
|
110
|
+
btnClass = button + (page > 0 ?
|
111
|
+
'' : ' disabled');
|
112
|
+
break;
|
113
|
+
|
114
|
+
case 'previous':
|
115
|
+
btnDisplay = lang.sPrevious;
|
116
|
+
btnClass = button + (page > 0 ?
|
117
|
+
'' : ' disabled');
|
118
|
+
break;
|
119
|
+
|
120
|
+
case 'next':
|
121
|
+
btnDisplay = lang.sNext;
|
122
|
+
btnClass = button + (page < pages-1 ?
|
123
|
+
'' : ' disabled');
|
124
|
+
break;
|
125
|
+
|
126
|
+
case 'last':
|
127
|
+
btnDisplay = lang.sLast;
|
128
|
+
btnClass = button + (page < pages-1 ?
|
129
|
+
'' : ' disabled');
|
130
|
+
break;
|
131
|
+
|
132
|
+
default:
|
133
|
+
btnDisplay = button + 1;
|
134
|
+
btnClass = page === button ?
|
135
|
+
'active' : '';
|
136
|
+
break;
|
137
|
+
}
|
138
|
+
|
139
|
+
var tag = btnClass.indexOf( 'disabled' ) === -1 ?
|
140
|
+
'a' :
|
141
|
+
'div';
|
142
|
+
|
143
|
+
if ( btnDisplay ) {
|
144
|
+
node = $('<'+tag+'>', {
|
145
|
+
'class': classes.sPageButton+' '+btnClass,
|
146
|
+
'id': idx === 0 && typeof button === 'string' ?
|
147
|
+
settings.sTableId +'_'+ button :
|
148
|
+
null,
|
149
|
+
'href': '#',
|
150
|
+
'aria-controls': settings.sTableId,
|
151
|
+
'aria-label': aria[ button ],
|
152
|
+
'data-dt-idx': counter,
|
153
|
+
'tabindex': settings.iTabIndex
|
154
|
+
} )
|
155
|
+
.html( btnDisplay )
|
156
|
+
.appendTo( container );
|
157
|
+
|
158
|
+
settings.oApi._fnBindAction(
|
159
|
+
node, {action: button}, clickHandler
|
160
|
+
);
|
161
|
+
|
162
|
+
counter++;
|
163
|
+
}
|
164
|
+
}
|
165
|
+
}
|
166
|
+
};
|
167
|
+
|
168
|
+
// IE9 throws an 'unknown error' if document.activeElement is used
|
169
|
+
// inside an iframe or frame.
|
170
|
+
var activeEl;
|
171
|
+
|
172
|
+
try {
|
173
|
+
// Because this approach is destroying and recreating the paging
|
174
|
+
// elements, focus is lost on the select button which is bad for
|
175
|
+
// accessibility. So we want to restore focus once the draw has
|
176
|
+
// completed
|
177
|
+
activeEl = $(host).find(document.activeElement).data('dt-idx');
|
178
|
+
}
|
179
|
+
catch (e) {}
|
180
|
+
|
181
|
+
attach(
|
182
|
+
$(host).empty().html('<div class="ui pagination menu"/>').children(),
|
183
|
+
buttons
|
184
|
+
);
|
185
|
+
|
186
|
+
if ( activeEl ) {
|
187
|
+
$(host).find( '[data-dt-idx='+activeEl+']' ).focus();
|
188
|
+
}
|
189
|
+
};
|
190
|
+
|
191
|
+
|
192
|
+
// Javascript enhancements on table initialisation
|
193
|
+
$(document).on( 'init.dt', function (e, ctx) {
|
194
|
+
if ( e.namespace !== 'dt' ) {
|
195
|
+
return;
|
196
|
+
}
|
197
|
+
|
198
|
+
// Length menu drop down
|
199
|
+
if ( $.fn.dropdown ) {
|
200
|
+
var api = new $.fn.dataTable.Api( ctx );
|
201
|
+
|
202
|
+
$( 'div.dataTables_length select', api.table().container() ).dropdown();
|
203
|
+
}
|
204
|
+
} );
|
205
|
+
|
206
|
+
|
207
|
+
return DataTable;
|
208
|
+
}));
|
@@ -0,0 +1,176 @@
|
|
1
|
+
/*! DataTables UIkit 3 integration
|
2
|
+
*/
|
3
|
+
|
4
|
+
/**
|
5
|
+
* This is a tech preview of UIKit integration with DataTables.
|
6
|
+
*/
|
7
|
+
(function( factory ){
|
8
|
+
if ( typeof define === 'function' && define.amd ) {
|
9
|
+
// AMD
|
10
|
+
define( ['jquery', 'datatables.net'], function ( $ ) {
|
11
|
+
return factory( $, window, document );
|
12
|
+
} );
|
13
|
+
}
|
14
|
+
else if ( typeof exports === 'object' ) {
|
15
|
+
// CommonJS
|
16
|
+
module.exports = function (root, $) {
|
17
|
+
if ( ! root ) {
|
18
|
+
root = window;
|
19
|
+
}
|
20
|
+
|
21
|
+
if ( ! $ || ! $.fn.dataTable ) {
|
22
|
+
// Require DataTables, which attaches to jQuery, including
|
23
|
+
// jQuery if needed and have a $ property so we can access the
|
24
|
+
// jQuery object that is used
|
25
|
+
$ = require('datatables.net')(root, $).$;
|
26
|
+
}
|
27
|
+
|
28
|
+
return factory( $, root, root.document );
|
29
|
+
};
|
30
|
+
}
|
31
|
+
else {
|
32
|
+
// Browser
|
33
|
+
factory( jQuery, window, document );
|
34
|
+
}
|
35
|
+
}(function( $, window, document, undefined ) {
|
36
|
+
'use strict';
|
37
|
+
var DataTable = $.fn.dataTable;
|
38
|
+
|
39
|
+
|
40
|
+
/* Set the defaults for DataTables initialisation */
|
41
|
+
$.extend( true, DataTable.defaults, {
|
42
|
+
dom:
|
43
|
+
"<'row uk-grid'<'uk-width-1-2'l><'uk-width-1-2'f>>" +
|
44
|
+
"<'row uk-grid dt-merge-grid'<'uk-width-1-1'tr>>" +
|
45
|
+
"<'row uk-grid dt-merge-grid'<'uk-width-2-5'i><'uk-width-3-5'p>>",
|
46
|
+
renderer: 'uikit'
|
47
|
+
} );
|
48
|
+
|
49
|
+
|
50
|
+
/* Default class modification */
|
51
|
+
$.extend( DataTable.ext.classes, {
|
52
|
+
sWrapper: "dataTables_wrapper uk-form dt-uikit",
|
53
|
+
sFilterInput: "uk-form-small",
|
54
|
+
sLengthSelect: "uk-form-small",
|
55
|
+
sProcessing: "dataTables_processing uk-panel"
|
56
|
+
} );
|
57
|
+
|
58
|
+
|
59
|
+
/* UIkit paging button renderer */
|
60
|
+
DataTable.ext.renderer.pageButton.uikit = function ( settings, host, idx, buttons, page, pages ) {
|
61
|
+
var api = new DataTable.Api( settings );
|
62
|
+
var classes = settings.oClasses;
|
63
|
+
var lang = settings.oLanguage.oPaginate;
|
64
|
+
var aria = settings.oLanguage.oAria.paginate || {};
|
65
|
+
var btnDisplay, btnClass, counter=0;
|
66
|
+
|
67
|
+
var attach = function( container, buttons ) {
|
68
|
+
var i, ien, node, button;
|
69
|
+
var clickHandler = function ( e ) {
|
70
|
+
e.preventDefault();
|
71
|
+
if ( !$(e.currentTarget).hasClass('disabled') && api.page() != e.data.action ) {
|
72
|
+
api.page( e.data.action ).draw( 'page' );
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
|
77
|
+
button = buttons[i];
|
78
|
+
|
79
|
+
if ( $.isArray( button ) ) {
|
80
|
+
attach( container, button );
|
81
|
+
}
|
82
|
+
else {
|
83
|
+
btnDisplay = '';
|
84
|
+
btnClass = '';
|
85
|
+
|
86
|
+
switch ( button ) {
|
87
|
+
case 'ellipsis':
|
88
|
+
btnDisplay = '<i class="uk-icon-ellipsis-h"></i>';
|
89
|
+
btnClass = 'uk-disabled disabled';
|
90
|
+
break;
|
91
|
+
|
92
|
+
case 'first':
|
93
|
+
btnDisplay = '<i class="uk-icon-angle-double-left"></i> ' + lang.sFirst;
|
94
|
+
btnClass = (page > 0 ?
|
95
|
+
'' : ' uk-disabled disabled');
|
96
|
+
break;
|
97
|
+
|
98
|
+
case 'previous':
|
99
|
+
btnDisplay = '<i class="uk-icon-angle-left"></i> ' + lang.sPrevious;
|
100
|
+
btnClass = (page > 0 ?
|
101
|
+
'' : 'uk-disabled disabled');
|
102
|
+
break;
|
103
|
+
|
104
|
+
case 'next':
|
105
|
+
btnDisplay = lang.sNext + ' <i class="uk-icon-angle-right"></i>';
|
106
|
+
btnClass = (page < pages-1 ?
|
107
|
+
'' : 'uk-disabled disabled');
|
108
|
+
break;
|
109
|
+
|
110
|
+
case 'last':
|
111
|
+
btnDisplay = lang.sLast + ' <i class="uk-icon-angle-double-right"></i>';
|
112
|
+
btnClass = (page < pages-1 ?
|
113
|
+
'' : ' uk-disabled disabled');
|
114
|
+
break;
|
115
|
+
|
116
|
+
default:
|
117
|
+
btnDisplay = button + 1;
|
118
|
+
btnClass = page === button ?
|
119
|
+
'uk-active' : '';
|
120
|
+
break;
|
121
|
+
}
|
122
|
+
|
123
|
+
if ( btnDisplay ) {
|
124
|
+
node = $('<li>', {
|
125
|
+
'class': classes.sPageButton+' '+btnClass,
|
126
|
+
'id': idx === 0 && typeof button === 'string' ?
|
127
|
+
settings.sTableId +'_'+ button :
|
128
|
+
null
|
129
|
+
} )
|
130
|
+
.append( $(( -1 != btnClass.indexOf('disabled') || -1 != btnClass.indexOf('active') ) ? '<span>' : '<a>', {
|
131
|
+
'href': '#',
|
132
|
+
'aria-controls': settings.sTableId,
|
133
|
+
'aria-label': aria[ button ],
|
134
|
+
'data-dt-idx': counter,
|
135
|
+
'tabindex': settings.iTabIndex
|
136
|
+
} )
|
137
|
+
.html( btnDisplay )
|
138
|
+
)
|
139
|
+
.appendTo( container );
|
140
|
+
|
141
|
+
settings.oApi._fnBindAction(
|
142
|
+
node, {action: button}, clickHandler
|
143
|
+
);
|
144
|
+
|
145
|
+
counter++;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
};
|
150
|
+
|
151
|
+
// IE9 throws an 'unknown error' if document.activeElement is used
|
152
|
+
// inside an iframe or frame.
|
153
|
+
var activeEl;
|
154
|
+
|
155
|
+
try {
|
156
|
+
// Because this approach is destroying and recreating the paging
|
157
|
+
// elements, focus is lost on the select button which is bad for
|
158
|
+
// accessibility. So we want to restore focus once the draw has
|
159
|
+
// completed
|
160
|
+
activeEl = $(host).find(document.activeElement).data('dt-idx');
|
161
|
+
}
|
162
|
+
catch (e) {}
|
163
|
+
|
164
|
+
attach(
|
165
|
+
$(host).empty().html('<ul class="uk-pagination uk-pagination-right"/>').children('ul'),
|
166
|
+
buttons
|
167
|
+
);
|
168
|
+
|
169
|
+
if ( activeEl ) {
|
170
|
+
$(host).find( '[data-dt-idx='+activeEl+']' ).focus();
|
171
|
+
}
|
172
|
+
};
|
173
|
+
|
174
|
+
|
175
|
+
return DataTable;
|
176
|
+
}));
|