jquery-datatables 1.10.16 → 1.10.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +2 -0
- data/app/assets/javascripts/datatables/dataTables.foundation.js +2 -2
- data/app/assets/javascripts/datatables/dataTables.uikit.js +1 -1
- data/app/assets/javascripts/datatables/extensions/AutoFill/autoFill.dataTables.js +38 -0
- data/app/assets/javascripts/datatables/extensions/AutoFill/dataTables.autoFill.js +52 -12
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.colVis.js +4 -8
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.dataTables.js +38 -0
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.flash.js +17 -7
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.html5.js +33 -19
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.print.js +14 -3
- data/app/assets/javascripts/datatables/extensions/Buttons/dataTables.buttons.js +120 -53
- data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.bootstrap.js +38 -0
- data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.bootstrap4.js +38 -0
- data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.dataTables.js +38 -0
- data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.foundation.js +38 -0
- data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.jqueryui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.semanicui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/ColReorder/dataTables.colReorder.js +76 -13
- data/app/assets/javascripts/datatables/extensions/FixedColumns/dataTables.fixedColumns.js +23 -17
- data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.bootstrap.js +38 -0
- data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.bootstrap4.js +38 -0
- data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.dataTables.js +38 -0
- data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.foundation.js +38 -0
- data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.jqueryui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.semanicui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/FixedHeader/dataTables.fixedHeader.js +26 -11
- data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.bootstrap.js +38 -0
- data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.bootstrap4.js +38 -0
- data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.dataTables.js +38 -0
- data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.foundation.js +38 -0
- data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.jqueryui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.semanicui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/KeyTable/dataTables.keyTable.js +141 -75
- data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.bootstrap.js +38 -0
- data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.bootstrap4.js +38 -0
- data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.dataTables.js +38 -0
- data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.foundation.js +38 -0
- data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.jqueryui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.semanicui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/Responsive/dataTables.responsive.js +64 -26
- data/app/assets/javascripts/datatables/extensions/Responsive/responsive.dataTables.js +38 -0
- data/app/assets/javascripts/datatables/extensions/RowGroup/dataTables.rowGroup.js +45 -13
- data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.bootstrap.js +38 -0
- data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.bootstrap4.js +38 -0
- data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.dataTables.js +38 -0
- data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.foundation.js +38 -0
- data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.jqueryui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.semanicui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/RowReorder/dataTables.rowReorder.js +24 -6
- data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.bootstrap.js +38 -0
- data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.bootstrap4.js +38 -0
- data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.dataTables.js +38 -0
- data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.foundation.js +38 -0
- data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.jqueryui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.semanicui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/Scroller/dataTables.scroller.js +93 -87
- data/app/assets/javascripts/datatables/extensions/Scroller/scroller.bootstrap.js +38 -0
- data/app/assets/javascripts/datatables/extensions/Scroller/scroller.bootstrap4.js +38 -0
- data/app/assets/javascripts/datatables/extensions/Scroller/scroller.dataTables.js +38 -0
- data/app/assets/javascripts/datatables/extensions/Scroller/scroller.foundation.js +38 -0
- data/app/assets/javascripts/datatables/extensions/Scroller/scroller.jqueryui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/Scroller/scroller.semanticui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/Select/dataTables.select.js +41 -14
- data/app/assets/javascripts/datatables/extensions/Select/select.bootstrap.js +38 -0
- data/app/assets/javascripts/datatables/extensions/Select/select.bootstrap4.js +38 -0
- data/app/assets/javascripts/datatables/extensions/Select/select.dataTables.js +38 -0
- data/app/assets/javascripts/datatables/extensions/Select/select.foundation.js +38 -0
- data/app/assets/javascripts/datatables/extensions/Select/select.jqueryui.js +38 -0
- data/app/assets/javascripts/datatables/extensions/Select/select.semanticui.js +38 -0
- data/app/assets/javascripts/datatables/jquery.dataTables.js +125 -72
- data/app/assets/stylesheets/datatables/dataTables.bootstrap4.scss +4 -0
- data/app/assets/stylesheets/datatables/dataTables.foundation.scss +5 -5
- data/app/assets/stylesheets/datatables/dataTables.material.scss +1 -1
- data/app/assets/stylesheets/datatables/dataTables.uikit.scss +33 -22
- data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.bootstrap.scss +9 -0
- data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.bootstrap4.scss +9 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.dataTables.scss +3 -2
- data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.jqueryui.scss +2 -4
- data/app/assets/stylesheets/datatables/extensions/Buttons/mixins.scss +5 -0
- data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.bootstrap4.scss +3 -6
- data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.bootstrap.scss +1 -1
- data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.bootstrap4.scss +1 -1
- data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.dataTables.scss +6 -5
- data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.foundation.scss +1 -1
- data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.semanticui.scss +1 -1
- data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.bootstrap.scss +1 -1
- data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.bootstrap4.scss +2 -4
- data/app/assets/stylesheets/datatables/jquery.dataTables.scss +5 -5
- data/jquery-datatables.gemspec +4 -2
- data/lib/generators/jquery/datatables/install_generator.rb +22 -6
- data/lib/generators/jquery/datatables/templates/{bootstrap.js.tt → javascripts/bootstrap.js.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/{bootstrap4.js.tt → javascripts/bootstrap4.js.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/{foundation.js.tt → javascripts/foundation.js.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/javascripts/initializer.js.tt +30 -0
- data/lib/generators/jquery/datatables/templates/{jqueryui.js.tt → javascripts/jqueryui.js.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/{material.js.tt → javascripts/material.js.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/{regular.js.tt → javascripts/regular.js.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/{semanticui.js.tt → javascripts/semanticui.js.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/{uikit.js.tt → javascripts/uikit.js.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/{bootstrap.scss.tt → stylesheets/bootstrap.scss.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/{bootstrap4.scss.tt → stylesheets/bootstrap4.scss.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/{foundation.scss.tt → stylesheets/foundation.scss.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/{jqueryui.scss.tt → stylesheets/jqueryui.scss.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/{material.scss.tt → stylesheets/material.scss.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/{regular.scss.tt → stylesheets/regular.scss.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/{semanticui.scss.tt → stylesheets/semanticui.scss.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/{uikit.scss.tt → stylesheets/uikit.scss.tt} +0 -0
- data/lib/generators/jquery/datatables/templates/views/index.html.erb +17 -0
- data/lib/generators/jquery/datatables/templates/views/index.html.slim +12 -0
- data/lib/generators/jquery/datatables/templates/views/index.json.jbuilder +10 -0
- data/lib/jquery-datatables.rb +53 -5
- data/lib/jquery-datatables/engine.rb +2 -0
- data/lib/jquery-datatables/version.rb +1 -1
- metadata +86 -31
@@ -91,12 +91,23 @@ DataTable.ext.buttons.print = {
|
|
91
91
|
$.extend( {decodeEntities: false}, config.exportOptions ) // XSS protection
|
92
92
|
);
|
93
93
|
var exportInfo = dt.buttons.exportInfo( config );
|
94
|
+
var columnClasses = $.map( dt.settings()[0].aoColumns, function (col, key) {
|
95
|
+
return col.sClass;
|
96
|
+
} );
|
94
97
|
|
95
98
|
var addRow = function ( d, tag ) {
|
96
99
|
var str = '<tr>';
|
97
100
|
|
98
101
|
for ( var i=0, ien=d.length ; i<ien ; i++ ) {
|
99
|
-
|
102
|
+
// null and undefined aren't useful in the print output
|
103
|
+
var dataOut = d[i] === null || d[i] === undefined ?
|
104
|
+
'' :
|
105
|
+
d[i];
|
106
|
+
var classAttr = columnClasses[i] ?
|
107
|
+
'class="'+columnClasses[i]+'"' :
|
108
|
+
'';
|
109
|
+
|
110
|
+
str += '<'+tag+' '+classAttr+'>'+dataOut+'</'+tag+'>';
|
100
111
|
}
|
101
112
|
|
102
113
|
return str + '</tr>';
|
@@ -154,11 +165,11 @@ DataTable.ext.buttons.print = {
|
|
154
165
|
} );
|
155
166
|
|
156
167
|
if ( config.customize ) {
|
157
|
-
config.customize( win );
|
168
|
+
config.customize( win, config, dt );
|
158
169
|
}
|
159
170
|
|
160
171
|
// Allow stylesheets time to load
|
161
|
-
setTimeout( function () {
|
172
|
+
win.setTimeout( function () {
|
162
173
|
if ( config.autoPrint ) {
|
163
174
|
win.print(); // blocking - so close will not
|
164
175
|
win.close(); // execute until this is done
|
@@ -1,5 +1,5 @@
|
|
1
|
-
/*! Buttons for DataTables 1.
|
2
|
-
* ©2016-
|
1
|
+
/*! Buttons for DataTables 1.5.2
|
2
|
+
* ©2016-2018 SpryMedia Ltd - datatables.net/license
|
3
3
|
*/
|
4
4
|
|
5
5
|
(function( factory ){
|
@@ -379,8 +379,10 @@ $.extend( Buttons.prototype, {
|
|
379
379
|
this.add( buttons[i] );
|
380
380
|
}
|
381
381
|
|
382
|
-
dt.on( 'destroy', function () {
|
383
|
-
|
382
|
+
dt.on( 'destroy', function ( e, settings ) {
|
383
|
+
if ( settings === dtSettings ) {
|
384
|
+
that.destroy();
|
385
|
+
}
|
384
386
|
} );
|
385
387
|
|
386
388
|
// Global key event binding to listen for button keys
|
@@ -544,7 +546,8 @@ $.extend( Buttons.prototype, {
|
|
544
546
|
] );
|
545
547
|
};
|
546
548
|
|
547
|
-
var
|
549
|
+
var tag = config.tag || buttonDom.tag;
|
550
|
+
var button = $('<'+tag+'/>')
|
548
551
|
.addClass( buttonDom.className )
|
549
552
|
.attr( 'tabindex', this.s.dt.settings()[0].iTabIndex )
|
550
553
|
.attr( 'aria-controls', this.s.dt.table().node().id )
|
@@ -566,10 +569,15 @@ $.extend( Buttons.prototype, {
|
|
566
569
|
} );
|
567
570
|
|
568
571
|
// Make `a` tags act like a link
|
569
|
-
if (
|
572
|
+
if ( tag.toLowerCase() === 'a' ) {
|
570
573
|
button.attr( 'href', '#' );
|
571
574
|
}
|
572
575
|
|
576
|
+
// Button tags should have `type=button` so they don't have any default behaviour
|
577
|
+
if ( tag.toLowerCase() === 'button' ) {
|
578
|
+
button.attr( 'type', 'button' );
|
579
|
+
}
|
580
|
+
|
573
581
|
if ( linerDom.tag ) {
|
574
582
|
var liner = $('<'+linerDom.tag+'/>')
|
575
583
|
.html( text( config.text ) )
|
@@ -597,6 +605,10 @@ $.extend( Buttons.prototype, {
|
|
597
605
|
button.attr( 'title', text( config.titleAttr ) );
|
598
606
|
}
|
599
607
|
|
608
|
+
if ( config.attr ) {
|
609
|
+
button.attr( config.attr );
|
610
|
+
}
|
611
|
+
|
600
612
|
if ( ! config.namespace ) {
|
601
613
|
config.namespace = '.dt-button-'+(_buttonCounter++);
|
602
614
|
}
|
@@ -689,12 +701,18 @@ $.extend( Buttons.prototype, {
|
|
689
701
|
*/
|
690
702
|
_keypress: function ( character, e )
|
691
703
|
{
|
704
|
+
// Check if this button press already activated on another instance of Buttons
|
705
|
+
if ( e._buttonsHandled ) {
|
706
|
+
return;
|
707
|
+
}
|
708
|
+
|
692
709
|
var run = function ( conf, node ) {
|
693
710
|
if ( ! conf.key ) {
|
694
711
|
return;
|
695
712
|
}
|
696
713
|
|
697
714
|
if ( conf.key === character ) {
|
715
|
+
e._buttonsHandled = true;
|
698
716
|
$(node).click();
|
699
717
|
}
|
700
718
|
else if ( $.isPlainObject( conf.key ) ) {
|
@@ -719,6 +737,7 @@ $.extend( Buttons.prototype, {
|
|
719
737
|
}
|
720
738
|
|
721
739
|
// Made it this far - it is good
|
740
|
+
e._buttonsHandled = true;
|
722
741
|
$(node).click();
|
723
742
|
}
|
724
743
|
};
|
@@ -1126,7 +1145,7 @@ Buttons.defaults = {
|
|
1126
1145
|
className: 'dt-button-collection'
|
1127
1146
|
},
|
1128
1147
|
button: {
|
1129
|
-
tag: '
|
1148
|
+
tag: 'button',
|
1130
1149
|
className: 'dt-button',
|
1131
1150
|
active: 'active',
|
1132
1151
|
disabled: 'disabled'
|
@@ -1143,7 +1162,7 @@ Buttons.defaults = {
|
|
1143
1162
|
* @type {string}
|
1144
1163
|
* @static
|
1145
1164
|
*/
|
1146
|
-
Buttons.version = '1.
|
1165
|
+
Buttons.version = '1.5.2';
|
1147
1166
|
|
1148
1167
|
|
1149
1168
|
$.extend( _dtButtons, {
|
@@ -1154,21 +1173,29 @@ $.extend( _dtButtons, {
|
|
1154
1173
|
className: 'buttons-collection',
|
1155
1174
|
action: function ( e, dt, button, config ) {
|
1156
1175
|
var host = button;
|
1157
|
-
var
|
1176
|
+
var collectionParent = $(button).parents('div.dt-button-collection');
|
1177
|
+
var hostPosition = host.position();
|
1158
1178
|
var tableContainer = $( dt.table().container() );
|
1159
1179
|
var multiLevel = false;
|
1180
|
+
var insertPoint = host;
|
1160
1181
|
|
1161
1182
|
// Remove any old collection
|
1162
|
-
if (
|
1163
|
-
multiLevel = $('.dt-button-collection').
|
1183
|
+
if ( collectionParent.length ) {
|
1184
|
+
multiLevel = $('.dt-button-collection').position();
|
1185
|
+
insertPoint = collectionParent;
|
1164
1186
|
$('body').trigger( 'click.dtb-collection' );
|
1165
1187
|
}
|
1166
1188
|
|
1189
|
+
if ( insertPoint.parents('body')[0] !== document.body ) {
|
1190
|
+
insertPoint = document.body.lastChild;
|
1191
|
+
}
|
1192
|
+
|
1167
1193
|
config._collection
|
1168
1194
|
.addClass( config.collectionLayout )
|
1169
1195
|
.css( 'display', 'none' )
|
1170
|
-
.
|
1196
|
+
.insertAfter( insertPoint )
|
1171
1197
|
.fadeIn( config.fade );
|
1198
|
+
|
1172
1199
|
|
1173
1200
|
var position = config._collection.css( 'position' );
|
1174
1201
|
|
@@ -1180,29 +1207,36 @@ $.extend( _dtButtons, {
|
|
1180
1207
|
}
|
1181
1208
|
else if ( position === 'absolute' ) {
|
1182
1209
|
config._collection.css( {
|
1183
|
-
top:
|
1184
|
-
left:
|
1210
|
+
top: hostPosition.top + host.outerHeight(),
|
1211
|
+
left: hostPosition.left
|
1185
1212
|
} );
|
1186
1213
|
|
1187
1214
|
// calculate overflow when positioned beneath
|
1188
1215
|
var tableBottom = tableContainer.offset().top + tableContainer.height();
|
1189
|
-
var listBottom =
|
1216
|
+
var listBottom = hostPosition.top + host.outerHeight() + config._collection.outerHeight();
|
1190
1217
|
var bottomOverflow = listBottom - tableBottom;
|
1191
1218
|
|
1192
1219
|
// calculate overflow when positioned above
|
1193
|
-
var listTop =
|
1220
|
+
var listTop = hostPosition.top - config._collection.outerHeight();
|
1194
1221
|
var tableTop = tableContainer.offset().top;
|
1195
1222
|
var topOverflow = tableTop - listTop;
|
1196
1223
|
|
1197
|
-
// if bottom overflow is larger, move to the top because it fits better
|
1198
|
-
if (bottomOverflow > topOverflow) {
|
1199
|
-
config._collection.css( 'top',
|
1224
|
+
// if bottom overflow is larger, move to the top because it fits better, or if dropup is requested
|
1225
|
+
if (bottomOverflow > topOverflow || config.dropup) {
|
1226
|
+
config._collection.css( 'top', hostPosition.top - config._collection.outerHeight() - 5);
|
1200
1227
|
}
|
1201
1228
|
|
1202
|
-
|
1229
|
+
// Right alignment in table container
|
1230
|
+
var listRight = hostPosition.left + config._collection.outerWidth();
|
1203
1231
|
var tableRight = tableContainer.offset().left + tableContainer.width();
|
1204
1232
|
if ( listRight > tableRight ) {
|
1205
|
-
config._collection.css( 'left',
|
1233
|
+
config._collection.css( 'left', hostPosition.left - ( listRight - tableRight ) );
|
1234
|
+
}
|
1235
|
+
|
1236
|
+
// Right alignment to window
|
1237
|
+
var listOffsetRight = host.offset().left + config._collection.outerWidth();
|
1238
|
+
if ( listOffsetRight > $(window).width() ) {
|
1239
|
+
config._collection.css( 'left', hostPosition.left - (listOffsetRight-$(window).width()) );
|
1206
1240
|
}
|
1207
1241
|
}
|
1208
1242
|
else {
|
@@ -1219,6 +1253,19 @@ $.extend( _dtButtons, {
|
|
1219
1253
|
Buttons.background( true, config.backgroundClassName, config.fade );
|
1220
1254
|
}
|
1221
1255
|
|
1256
|
+
var close = function () {
|
1257
|
+
config._collection
|
1258
|
+
.fadeOut( config.fade, function () {
|
1259
|
+
config._collection.detach();
|
1260
|
+
} );
|
1261
|
+
|
1262
|
+
$('div.dt-button-background').off( 'click.dtb-collection' );
|
1263
|
+
Buttons.background( false, config.backgroundClassName, config.fade );
|
1264
|
+
|
1265
|
+
$('body').off( '.dtb-collection' );
|
1266
|
+
dt.off( 'buttons-action.b-internal' );
|
1267
|
+
};
|
1268
|
+
|
1222
1269
|
// Need to break the 'thread' for the collection button being
|
1223
1270
|
// activated by a click - it would also trigger this event
|
1224
1271
|
setTimeout( function () {
|
@@ -1228,36 +1275,36 @@ $.extend( _dtButtons, {
|
|
1228
1275
|
// required to make it work...
|
1229
1276
|
$('div.dt-button-background').on( 'click.dtb-collection', function () {} );
|
1230
1277
|
|
1231
|
-
$('body')
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
config._collection
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1278
|
+
$('body')
|
1279
|
+
.on( 'click.dtb-collection', function (e) {
|
1280
|
+
// andSelf is deprecated in jQ1.8, but we want 1.7 compat
|
1281
|
+
var back = $.fn.addBack ? 'addBack' : 'andSelf';
|
1282
|
+
|
1283
|
+
if ( ! $(e.target).parents()[back]().filter( config._collection ).length ) {
|
1284
|
+
close();
|
1285
|
+
}
|
1286
|
+
} )
|
1287
|
+
.on( 'keyup.dtb-collection', function (e) {
|
1288
|
+
if ( e.keyCode === 27 ) {
|
1289
|
+
close();
|
1290
|
+
}
|
1291
|
+
} );
|
1243
1292
|
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1293
|
+
if ( config.autoClose ) {
|
1294
|
+
dt.on( 'buttons-action.b-internal', function () {
|
1295
|
+
close();
|
1296
|
+
} );
|
1297
|
+
}
|
1248
1298
|
}, 10 );
|
1249
|
-
|
1250
|
-
if ( config.autoClose ) {
|
1251
|
-
dt.on( 'buttons-action.b-internal', function () {
|
1252
|
-
$('div.dt-button-background').click();
|
1253
|
-
} );
|
1254
|
-
}
|
1255
1299
|
},
|
1256
1300
|
background: true,
|
1257
1301
|
collectionLayout: '',
|
1258
1302
|
backgroundClassName: 'dt-button-background',
|
1259
1303
|
autoClose: false,
|
1260
|
-
fade: 400
|
1304
|
+
fade: 400,
|
1305
|
+
attr: {
|
1306
|
+
'aria-haspopup': true
|
1307
|
+
}
|
1261
1308
|
},
|
1262
1309
|
copy: function ( dt, conf ) {
|
1263
1310
|
if ( _dtButtons.copyHtml5 ) {
|
@@ -1585,7 +1632,7 @@ DataTable.Api.register( 'buttons.exportInfo()', function ( conf ) {
|
|
1585
1632
|
return {
|
1586
1633
|
filename: _filename( conf ),
|
1587
1634
|
title: _title( conf ),
|
1588
|
-
messageTop: _message(this, conf.
|
1635
|
+
messageTop: _message(this, conf.message || conf.messageTop, 'top'),
|
1589
1636
|
messageBottom: _message(this, conf.messageBottom, 'bottom')
|
1590
1637
|
};
|
1591
1638
|
} );
|
@@ -1601,7 +1648,7 @@ DataTable.Api.register( 'buttons.exportInfo()', function ( conf ) {
|
|
1601
1648
|
var _filename = function ( config )
|
1602
1649
|
{
|
1603
1650
|
// Backwards compatibility
|
1604
|
-
var filename = config.filename === '*' && config.title !== '*' && config.title !== undefined ?
|
1651
|
+
var filename = config.filename === '*' && config.title !== '*' && config.title !== undefined && config.title !== null && config.title !== '' ?
|
1605
1652
|
config.title :
|
1606
1653
|
config.filename;
|
1607
1654
|
|
@@ -1614,7 +1661,7 @@ var _filename = function ( config )
|
|
1614
1661
|
}
|
1615
1662
|
|
1616
1663
|
if ( filename.indexOf( '*' ) !== -1 ) {
|
1617
|
-
filename = $.trim( filename.replace( '*', $('title').text() ) );
|
1664
|
+
filename = $.trim( filename.replace( '*', $('head > title').text() ) );
|
1618
1665
|
}
|
1619
1666
|
|
1620
1667
|
// Strip characters which the OS will object to
|
@@ -1656,7 +1703,7 @@ var _title = function ( config )
|
|
1656
1703
|
|
1657
1704
|
return title === null ?
|
1658
1705
|
null : title.indexOf( '*' ) !== -1 ?
|
1659
|
-
title.replace( '*', $('title').text() || 'Exported data' ) :
|
1706
|
+
title.replace( '*', $('head > title').text() || 'Exported data' ) :
|
1660
1707
|
title;
|
1661
1708
|
};
|
1662
1709
|
|
@@ -1713,7 +1760,8 @@ var _exportData = function ( dt, inOpts )
|
|
1713
1760
|
body: function ( d ) {
|
1714
1761
|
return strip( d );
|
1715
1762
|
}
|
1716
|
-
}
|
1763
|
+
},
|
1764
|
+
customizeData: null
|
1717
1765
|
}, inOpts );
|
1718
1766
|
|
1719
1767
|
var strip = function ( str ) {
|
@@ -1724,6 +1772,9 @@ var _exportData = function ( dt, inOpts )
|
|
1724
1772
|
// Always remove script tags
|
1725
1773
|
str = str.replace( /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '' );
|
1726
1774
|
|
1775
|
+
// Always remove comments
|
1776
|
+
str = str.replace( /<!\-\-.*?\-\->/g, '' );
|
1777
|
+
|
1727
1778
|
if ( config.stripHtml ) {
|
1728
1779
|
str = str.replace( /<[^>]*>/g, '' );
|
1729
1780
|
}
|
@@ -1756,8 +1807,18 @@ var _exportData = function ( dt, inOpts )
|
|
1756
1807
|
return config.format.footer( el ? el.innerHTML : '', idx, el );
|
1757
1808
|
} ).toArray() :
|
1758
1809
|
null;
|
1810
|
+
|
1811
|
+
// If Select is available on this table, and any rows are selected, limit the export
|
1812
|
+
// to the selected rows. If no rows are selected, all rows will be exported. Specify
|
1813
|
+
// a `selected` modifier to control directly.
|
1814
|
+
var modifier = $.extend( {}, config.modifier );
|
1815
|
+
if ( dt.select && typeof dt.select.info === 'function' && modifier.selected === undefined ) {
|
1816
|
+
if ( dt.rows( config.rows, $.extend( { selected: true }, modifier ) ).any() ) {
|
1817
|
+
$.extend( modifier, { selected: true } )
|
1818
|
+
}
|
1819
|
+
}
|
1759
1820
|
|
1760
|
-
var rowIndexes = dt.rows( config.rows,
|
1821
|
+
var rowIndexes = dt.rows( config.rows, modifier ).indexes().toArray();
|
1761
1822
|
var selectedCells = dt.cells( rowIndexes, config.columns );
|
1762
1823
|
var cells = selectedCells
|
1763
1824
|
.render( config.orthogonal )
|
@@ -1768,11 +1829,11 @@ var _exportData = function ( dt, inOpts )
|
|
1768
1829
|
|
1769
1830
|
var columns = header.length;
|
1770
1831
|
var rows = columns > 0 ? cells.length / columns : 0;
|
1771
|
-
var body =
|
1832
|
+
var body = [];
|
1772
1833
|
var cellCounter = 0;
|
1773
1834
|
|
1774
1835
|
for ( var i=0, ien=rows ; i<ien ; i++ ) {
|
1775
|
-
var row =
|
1836
|
+
var row = [ columns ];
|
1776
1837
|
|
1777
1838
|
for ( var j=0 ; j<columns ; j++ ) {
|
1778
1839
|
row[j] = config.format.body( cells[ cellCounter ], i, j, cellNodes[ cellCounter ] );
|
@@ -1782,11 +1843,17 @@ var _exportData = function ( dt, inOpts )
|
|
1782
1843
|
body[i] = row;
|
1783
1844
|
}
|
1784
1845
|
|
1785
|
-
|
1846
|
+
var data = {
|
1786
1847
|
header: header,
|
1787
1848
|
footer: footer,
|
1788
1849
|
body: body
|
1789
1850
|
};
|
1851
|
+
|
1852
|
+
if ( config.customizeData ) {
|
1853
|
+
config.customizeData( data );
|
1854
|
+
}
|
1855
|
+
|
1856
|
+
return data;
|
1790
1857
|
};
|
1791
1858
|
|
1792
1859
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
/*! Bootstrap 3 styling wrapper for ColReorder
|
2
|
+
* ©2018 SpryMedia Ltd - datatables.net/license
|
3
|
+
*/
|
4
|
+
|
5
|
+
(function( factory ){
|
6
|
+
if ( typeof define === 'function' && define.amd ) {
|
7
|
+
// AMD
|
8
|
+
define( ['jquery', 'datatables.net-bs', 'datatables.net-colreorder'], function ( $ ) {
|
9
|
+
return factory( $, window, document );
|
10
|
+
} );
|
11
|
+
}
|
12
|
+
else if ( typeof exports === 'object' ) {
|
13
|
+
// CommonJS
|
14
|
+
module.exports = function (root, $) {
|
15
|
+
if ( ! root ) {
|
16
|
+
root = window;
|
17
|
+
}
|
18
|
+
|
19
|
+
if ( ! $ || ! $.fn.dataTable ) {
|
20
|
+
$ = require('datatables.net-bs')(root, $).$;
|
21
|
+
}
|
22
|
+
|
23
|
+
if ( ! $.fn.dataTable.ColReorder ) {
|
24
|
+
require('datatables.net-colreorder')(root, $);
|
25
|
+
}
|
26
|
+
|
27
|
+
return factory( $, root, root.document );
|
28
|
+
};
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
// Browser
|
32
|
+
factory( jQuery, window, document );
|
33
|
+
}
|
34
|
+
}(function( $, window, document, undefined ) {
|
35
|
+
|
36
|
+
return $.fn.dataTable;
|
37
|
+
|
38
|
+
}));
|
@@ -0,0 +1,38 @@
|
|
1
|
+
/*! Bootstrap 4 styling wrapper for ColReorder
|
2
|
+
* ©2018 SpryMedia Ltd - datatables.net/license
|
3
|
+
*/
|
4
|
+
|
5
|
+
(function( factory ){
|
6
|
+
if ( typeof define === 'function' && define.amd ) {
|
7
|
+
// AMD
|
8
|
+
define( ['jquery', 'datatables.net-bs4', 'datatables.net-colreorder'], function ( $ ) {
|
9
|
+
return factory( $, window, document );
|
10
|
+
} );
|
11
|
+
}
|
12
|
+
else if ( typeof exports === 'object' ) {
|
13
|
+
// CommonJS
|
14
|
+
module.exports = function (root, $) {
|
15
|
+
if ( ! root ) {
|
16
|
+
root = window;
|
17
|
+
}
|
18
|
+
|
19
|
+
if ( ! $ || ! $.fn.dataTable ) {
|
20
|
+
$ = require('datatables.net-bs4')(root, $).$;
|
21
|
+
}
|
22
|
+
|
23
|
+
if ( ! $.fn.dataTable.ColReorder ) {
|
24
|
+
require('datatables.net-colreorder')(root, $);
|
25
|
+
}
|
26
|
+
|
27
|
+
return factory( $, root, root.document );
|
28
|
+
};
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
// Browser
|
32
|
+
factory( jQuery, window, document );
|
33
|
+
}
|
34
|
+
}(function( $, window, document, undefined ) {
|
35
|
+
|
36
|
+
return $.fn.dataTable;
|
37
|
+
|
38
|
+
}));
|