effective_datatables 4.17.4 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,7 @@
1
- /*! Responsive 2.2.2
2
- * 2014-2018 SpryMedia Ltd - datatables.net/license
1
+ /*! Responsive 2.5.0
2
+ * © SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
5
- /**
6
- * @summary Responsive
7
- * @description Responsive tables plug-in for DataTables
8
- * @version 2.2.2
9
- * @file dataTables.responsive.js
10
- * @author SpryMedia Ltd (www.sprymedia.co.uk)
11
- * @contact www.sprymedia.co.uk/contact
12
- * @copyright Copyright 2014-2018 SpryMedia Ltd.
13
- *
14
- * This source file is free software, available under the following license:
15
- * MIT license - http://datatables.net/license/mit
16
- *
17
- * This source file is distributed in the hope that it will be useful, but
18
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19
- * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
20
- *
21
- * For details please refer to: http://www.datatables.net
22
- */
23
5
  (function( factory ){
24
6
  if ( typeof define === 'function' && define.amd ) {
25
7
  // AMD
@@ -29,17 +11,33 @@
29
11
  }
30
12
  else if ( typeof exports === 'object' ) {
31
13
  // CommonJS
32
- module.exports = function (root, $) {
33
- if ( ! root ) {
34
- root = window;
14
+ var jq = require('jquery');
15
+ var cjsRequires = function (root, $) {
16
+ if ( ! $.fn.dataTable ) {
17
+ require('datatables.net')(root, $);
35
18
  }
19
+ };
36
20
 
37
- if ( ! $ || ! $.fn.dataTable ) {
38
- $ = require('datatables.net')(root, $).$;
39
- }
21
+ if (typeof window === 'undefined') {
22
+ module.exports = function (root, $) {
23
+ if ( ! root ) {
24
+ // CommonJS environments without a window global must pass a
25
+ // root. This will give an error otherwise
26
+ root = window;
27
+ }
40
28
 
41
- return factory( $, root, root.document );
42
- };
29
+ if ( ! $ ) {
30
+ $ = jq( root );
31
+ }
32
+
33
+ cjsRequires( root, $ );
34
+ return factory( $, root, root.document );
35
+ };
36
+ }
37
+ else {
38
+ cjsRequires( window, jq );
39
+ module.exports = factory( jq, window, window.document );
40
+ }
43
41
  }
44
42
  else {
45
43
  // Browser
@@ -50,6 +48,24 @@
50
48
  var DataTable = $.fn.dataTable;
51
49
 
52
50
 
51
+
52
+ /**
53
+ * @summary Responsive
54
+ * @description Responsive tables plug-in for DataTables
55
+ * @version 2.5.0
56
+ * @author SpryMedia Ltd
57
+ * @copyright SpryMedia Ltd.
58
+ *
59
+ * This source file is free software, available under the following license:
60
+ * MIT license - http://datatables.net/license/mit
61
+ *
62
+ * This source file is distributed in the hope that it will be useful, but
63
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
64
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
65
+ *
66
+ * For details please refer to: http://www.datatables.net
67
+ */
68
+
53
69
  /**
54
70
  * Responsive is a plug-in for the DataTables library that makes use of
55
71
  * DataTables' ability to change the visibility of columns, changing the
@@ -95,41 +111,42 @@ var DataTable = $.fn.dataTable;
95
111
  * } );
96
112
  * } );
97
113
  */
98
- var Responsive = function ( settings, opts ) {
114
+ var Responsive = function (settings, opts) {
99
115
  // Sanity check that we are using DataTables 1.10 or newer
100
- if ( ! DataTable.versionCheck || ! DataTable.versionCheck( '1.10.10' ) ) {
116
+ if (!DataTable.versionCheck || !DataTable.versionCheck('1.10.10')) {
101
117
  throw 'DataTables Responsive requires DataTables 1.10.10 or newer';
102
118
  }
103
119
 
104
120
  this.s = {
105
- dt: new DataTable.Api( settings ),
121
+ childNodeStore: {},
106
122
  columns: [],
107
- current: []
123
+ current: [],
124
+ dt: new DataTable.Api(settings)
108
125
  };
109
126
 
110
127
  // Check if responsive has already been initialised on this table
111
- if ( this.s.dt.settings()[0].responsive ) {
128
+ if (this.s.dt.settings()[0].responsive) {
112
129
  return;
113
130
  }
114
131
 
115
132
  // details is an object, but for simplicity the user can give it as a string
116
133
  // or a boolean
117
- if ( opts && typeof opts.details === 'string' ) {
134
+ if (opts && typeof opts.details === 'string') {
118
135
  opts.details = { type: opts.details };
119
136
  }
120
- else if ( opts && opts.details === false ) {
137
+ else if (opts && opts.details === false) {
121
138
  opts.details = { type: false };
122
139
  }
123
- else if ( opts && opts.details === true ) {
140
+ else if (opts && opts.details === true) {
124
141
  opts.details = { type: 'inline' };
125
142
  }
126
143
 
127
- this.c = $.extend( true, {}, Responsive.defaults, DataTable.defaults.responsive, opts );
144
+ this.c = $.extend(true, {}, Responsive.defaults, DataTable.defaults.responsive, opts);
128
145
  settings.responsive = this;
129
146
  this._constructor();
130
147
  };
131
148
 
132
- $.extend( Responsive.prototype, {
149
+ $.extend(Responsive.prototype, {
133
150
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
134
151
  * Constructor
135
152
  */
@@ -139,63 +156,69 @@ $.extend( Responsive.prototype, {
139
156
  *
140
157
  * @private
141
158
  */
142
- _constructor: function ()
143
- {
159
+ _constructor: function () {
144
160
  var that = this;
145
161
  var dt = this.s.dt;
146
162
  var dtPrivateSettings = dt.settings()[0];
147
- var oldWindowWidth = $(window).width();
163
+ var oldWindowWidth = $(window).innerWidth();
148
164
 
149
165
  dt.settings()[0]._responsive = this;
150
166
 
151
167
  // Use DataTables' throttle function to avoid processor thrashing on
152
168
  // resize
153
- $(window).on( 'resize.dtr orientationchange.dtr', DataTable.util.throttle( function () {
154
- // iOS has a bug whereby resize can fire when only scrolling
155
- // See: http://stackoverflow.com/questions/8898412
156
- var width = $(window).width();
157
-
158
- if ( width !== oldWindowWidth ) {
159
- that._resize();
160
- oldWindowWidth = width;
161
- }
162
- } ) );
169
+ $(window).on(
170
+ 'resize.dtr orientationchange.dtr',
171
+ DataTable.util.throttle(function () {
172
+ // iOS has a bug whereby resize can fire when only scrolling
173
+ // See: http://stackoverflow.com/questions/8898412
174
+ var width = $(window).innerWidth();
175
+
176
+ if (width !== oldWindowWidth) {
177
+ that._resize();
178
+ oldWindowWidth = width;
179
+ }
180
+ })
181
+ );
163
182
 
164
183
  // DataTables doesn't currently trigger an event when a row is added, so
165
184
  // we need to hook into its private API to enforce the hidden rows when
166
185
  // new data is added
167
- dtPrivateSettings.oApi._fnCallbackReg( dtPrivateSettings, 'aoRowCreatedCallback', function (tr, data, idx) {
168
- if ( $.inArray( false, that.s.current ) !== -1 ) {
169
- $('>td, >th', tr).each( function ( i ) {
170
- var idx = dt.column.index( 'toData', i );
171
-
172
- if ( that.s.current[idx] === false ) {
173
- $(this).css('display', 'none');
174
- }
175
- } );
186
+ dtPrivateSettings.oApi._fnCallbackReg(
187
+ dtPrivateSettings,
188
+ 'aoRowCreatedCallback',
189
+ function (tr, data, idx) {
190
+ if ($.inArray(false, that.s.current) !== -1) {
191
+ $('>td, >th', tr).each(function (i) {
192
+ var idx = dt.column.index('toData', i);
193
+
194
+ if (that.s.current[idx] === false) {
195
+ $(this).css('display', 'none');
196
+ }
197
+ });
198
+ }
176
199
  }
177
- } );
200
+ );
178
201
 
179
202
  // Destroy event handler
180
- dt.on( 'destroy.dtr', function () {
181
- dt.off( '.dtr' );
182
- $( dt.table().body() ).off( '.dtr' );
183
- $(window).off( 'resize.dtr orientationchange.dtr' );
203
+ dt.on('destroy.dtr', function () {
204
+ dt.off('.dtr');
205
+ $(dt.table().body()).off('.dtr');
206
+ $(window).off('resize.dtr orientationchange.dtr');
207
+ dt.cells('.dtr-control').nodes().to$().removeClass('dtr-control');
184
208
 
185
209
  // Restore the columns that we've hidden
186
- $.each( that.s.current, function ( i, val ) {
187
- if ( val === false ) {
188
- that._setColumnVis( i, true );
210
+ $.each(that.s.current, function (i, val) {
211
+ if (val === false) {
212
+ that._setColumnVis(i, true);
189
213
  }
190
- } );
191
- } );
214
+ });
215
+ });
192
216
 
193
217
  // Reorder the breakpoints array here in case they have been added out
194
218
  // of order
195
- this.c.breakpoints.sort( function (a, b) {
196
- return a.width < b.width ? 1 :
197
- a.width > b.width ? -1 : 0;
198
- } );
219
+ this.c.breakpoints.sort(function (a, b) {
220
+ return a.width < b.width ? 1 : a.width > b.width ? -1 : 0;
221
+ });
199
222
 
200
223
  this._classLogic();
201
224
  this._resizeAuto();
@@ -203,90 +226,165 @@ $.extend( Responsive.prototype, {
203
226
  // Details handler
204
227
  var details = this.c.details;
205
228
 
206
- if ( details.type !== false ) {
229
+ if (details.type !== false) {
207
230
  that._detailsInit();
208
231
 
209
232
  // DataTables will trigger this event on every column it shows and
210
233
  // hides individually
211
- dt.on( 'column-visibility.dtr', function () {
234
+ dt.on('column-visibility.dtr', function () {
212
235
  // Use a small debounce to allow multiple columns to be set together
213
- if ( that._timer ) {
214
- clearTimeout( that._timer );
236
+ if (that._timer) {
237
+ clearTimeout(that._timer);
215
238
  }
216
239
 
217
- that._timer = setTimeout( function () {
240
+ that._timer = setTimeout(function () {
218
241
  that._timer = null;
219
242
 
220
243
  that._classLogic();
221
244
  that._resizeAuto();
222
- that._resize();
245
+ that._resize(true);
223
246
 
224
247
  that._redrawChildren();
225
- }, 100 );
226
- } );
248
+ }, 100);
249
+ });
227
250
 
228
251
  // Redraw the details box on each draw which will happen if the data
229
252
  // has changed. This is used until DataTables implements a native
230
253
  // `updated` event for rows
231
- dt.on( 'draw.dtr', function () {
254
+ dt.on('draw.dtr', function () {
232
255
  that._redrawChildren();
233
- } );
256
+ });
234
257
 
235
- $(dt.table().node()).addClass( 'dtr-'+details.type );
258
+ $(dt.table().node()).addClass('dtr-' + details.type);
236
259
  }
237
260
 
238
- dt.on( 'column-reorder.dtr', function (e, settings, details) {
261
+ dt.on('column-reorder.dtr', function (e, settings, details) {
239
262
  that._classLogic();
240
263
  that._resizeAuto();
241
- that._resize();
242
- } );
264
+ that._resize(true);
265
+ });
243
266
 
244
267
  // Change in column sizes means we need to calc
245
- dt.on( 'column-sizing.dtr', function () {
268
+ dt.on('column-sizing.dtr', function () {
246
269
  that._resizeAuto();
247
270
  that._resize();
248
271
  });
249
272
 
273
+ // DT2 let's us tell it if we are hiding columns
274
+ dt.on('column-calc.dt', function (e, d) {
275
+ var curr = that.s.current;
276
+
277
+ for (var i = 0; i < curr.length; i++) {
278
+ var idx = d.visible.indexOf(i);
279
+
280
+ if (curr[i] === false && idx >= 0) {
281
+ d.visible.splice(idx, 1);
282
+ }
283
+ }
284
+ });
285
+
250
286
  // On Ajax reload we want to reopen any child rows which are displayed
251
287
  // by responsive
252
- dt.on( 'preXhr.dtr', function () {
288
+ dt.on('preXhr.dtr', function () {
253
289
  var rowIds = [];
254
- dt.rows().every( function () {
255
- if ( this.child.isShown() ) {
256
- rowIds.push( this.id(true) );
290
+ dt.rows().every(function () {
291
+ if (this.child.isShown()) {
292
+ rowIds.push(this.id(true));
257
293
  }
258
- } );
294
+ });
259
295
 
260
- dt.one( 'draw.dtr', function () {
296
+ dt.one('draw.dtr', function () {
261
297
  that._resizeAuto();
262
298
  that._resize();
263
299
 
264
- dt.rows( rowIds ).every( function () {
265
- that._detailsDisplay( this, false );
266
- } );
267
- } );
300
+ dt.rows(rowIds).every(function () {
301
+ that._detailsDisplay(this, false);
302
+ });
303
+ });
268
304
  });
269
305
 
270
- dt.on( 'init.dtr', function (e, settings, details) {
306
+ dt.on('draw.dtr', function () {
307
+ that._controlClass();
308
+ }).on('init.dtr', function (e, settings, details) {
309
+ if (e.namespace !== 'dt') {
310
+ return;
311
+ }
312
+
271
313
  that._resizeAuto();
272
314
  that._resize();
273
315
 
274
316
  // If columns were hidden, then DataTables needs to adjust the
275
317
  // column sizing
276
- if ( $.inArray( false, that.s.current ) ) {
318
+ if ($.inArray(false, that.s.current)) {
277
319
  dt.columns.adjust();
278
320
  }
279
- } );
321
+ });
280
322
 
281
323
  // First pass - draw the table for the current viewport size
282
324
  this._resize();
283
325
  },
284
326
 
285
-
286
327
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
287
328
  * Private methods
288
329
  */
289
330
 
331
+ /**
332
+ * Get and store nodes from a cell - use for node moving renderers
333
+ *
334
+ * @param {*} dt DT instance
335
+ * @param {*} row Row index
336
+ * @param {*} col Column index
337
+ */
338
+ _childNodes: function (dt, row, col) {
339
+ var name = row + '-' + col;
340
+
341
+ if (this.s.childNodeStore[name]) {
342
+ return this.s.childNodeStore[name];
343
+ }
344
+
345
+ // https://jsperf.com/childnodes-array-slice-vs-loop
346
+ var nodes = [];
347
+ var children = dt.cell(row, col).node().childNodes;
348
+ for (var i = 0, ien = children.length; i < ien; i++) {
349
+ nodes.push(children[i]);
350
+ }
351
+
352
+ this.s.childNodeStore[name] = nodes;
353
+
354
+ return nodes;
355
+ },
356
+
357
+ /**
358
+ * Restore nodes from the cache to a table cell
359
+ *
360
+ * @param {*} dt DT instance
361
+ * @param {*} row Row index
362
+ * @param {*} col Column index
363
+ */
364
+ _childNodesRestore: function (dt, row, col) {
365
+ var name = row + '-' + col;
366
+
367
+ if (!this.s.childNodeStore[name]) {
368
+ return;
369
+ }
370
+
371
+ var node = dt.cell(row, col).node();
372
+ var store = this.s.childNodeStore[name];
373
+ var parent = store[0].parentNode;
374
+ var parentChildren = parent.childNodes;
375
+ var a = [];
376
+
377
+ for (var i = 0, ien = parentChildren.length; i < ien; i++) {
378
+ a.push(parentChildren[i]);
379
+ }
380
+
381
+ for (var j = 0, jen = a.length; j < jen; j++) {
382
+ node.appendChild(a[j]);
383
+ }
384
+
385
+ this.s.childNodeStore[name] = undefined;
386
+ },
387
+
290
388
  /**
291
389
  * Calculate the visibility for the columns in a table for a given
292
390
  * breakpoint. The result is pre-determined based on the class logic if
@@ -299,8 +397,7 @@ $.extend( Responsive.prototype, {
299
397
  * column.
300
398
  * @private
301
399
  */
302
- _columnsVisiblity: function ( breakpoint )
303
- {
400
+ _columnsVisiblity: function (breakpoint) {
304
401
  var dt = this.s.dt;
305
402
  var columns = this.s.columns;
306
403
  var i, ien;
@@ -309,38 +406,38 @@ $.extend( Responsive.prototype, {
309
406
  // column's priority, and secondly the column index. This allows the
310
407
  // columns to be removed from the right if the priority matches
311
408
  var order = columns
312
- .map( function ( col, idx ) {
409
+ .map(function (col, idx) {
313
410
  return {
314
411
  columnIdx: idx,
315
412
  priority: col.priority
316
413
  };
317
- } )
318
- .sort( function ( a, b ) {
319
- if ( a.priority !== b.priority ) {
414
+ })
415
+ .sort(function (a, b) {
416
+ if (a.priority !== b.priority) {
320
417
  return a.priority - b.priority;
321
418
  }
322
419
  return a.columnIdx - b.columnIdx;
323
- } );
420
+ });
324
421
 
325
422
  // Class logic - determine which columns are in this breakpoint based
326
423
  // on the classes. If no class control (i.e. `auto`) then `-` is used
327
424
  // to indicate this to the rest of the function
328
- var display = $.map( columns, function ( col, i ) {
329
- if ( dt.column(i).visible() === false ) {
425
+ var display = $.map(columns, function (col, i) {
426
+ if (dt.column(i).visible() === false) {
330
427
  return 'not-visible';
331
428
  }
332
- return col.auto && col.minWidth === null ?
333
- false :
334
- col.auto === true ?
335
- '-' :
336
- $.inArray( breakpoint, col.includeIn ) !== -1;
337
- } );
429
+ return col.auto && col.minWidth === null
430
+ ? false
431
+ : col.auto === true
432
+ ? '-'
433
+ : $.inArray(breakpoint, col.includeIn) !== -1;
434
+ });
338
435
 
339
436
  // Auto column control - first pass: how much width is taken by the
340
437
  // ones that must be included from the non-auto columns
341
438
  var requiredWidth = 0;
342
- for ( i=0, ien=display.length ; i<ien ; i++ ) {
343
- if ( display[i] === true ) {
439
+ for (i = 0, ien = display.length; i < ien; i++) {
440
+ if (display[i] === true) {
344
441
  requiredWidth += columns[i].minWidth;
345
442
  }
346
443
  }
@@ -360,8 +457,8 @@ $.extend( Responsive.prototype, {
360
457
  // thrashing or overflow. Also we need to account for the control column
361
458
  // width first so we know how much width is available for the other
362
459
  // columns, since the control column might not be the first one shown
363
- for ( i=0, ien=display.length ; i<ien ; i++ ) {
364
- if ( columns[i].control ) {
460
+ for (i = 0, ien = display.length; i < ien; i++) {
461
+ if (columns[i].control) {
365
462
  usedWidth -= columns[i].minWidth;
366
463
  }
367
464
  }
@@ -369,14 +466,14 @@ $.extend( Responsive.prototype, {
369
466
  // Allow columns to be shown (counting by priority and then right to
370
467
  // left) until we run out of room
371
468
  var empty = false;
372
- for ( i=0, ien=order.length ; i<ien ; i++ ) {
469
+ for (i = 0, ien = order.length; i < ien; i++) {
373
470
  var colIdx = order[i].columnIdx;
374
471
 
375
- if ( display[colIdx] === '-' && ! columns[colIdx].control && columns[colIdx].minWidth ) {
472
+ if (display[colIdx] === '-' && !columns[colIdx].control && columns[colIdx].minWidth) {
376
473
  // Once we've found a column that won't fit we don't let any
377
474
  // others display either, or columns might disappear in the
378
475
  // middle of the table
379
- if ( empty || usedWidth - columns[colIdx].minWidth < 0 ) {
476
+ if (empty || usedWidth - columns[colIdx].minWidth < 0) {
380
477
  empty = true;
381
478
  display[colIdx] = false;
382
479
  }
@@ -395,34 +492,33 @@ $.extend( Responsive.prototype, {
395
492
  // first , before the action in the second can be taken
396
493
  var showControl = false;
397
494
 
398
- for ( i=0, ien=columns.length ; i<ien ; i++ ) {
399
- if ( ! columns[i].control && ! columns[i].never && display[i] === false ) {
495
+ for (i = 0, ien = columns.length; i < ien; i++) {
496
+ if (!columns[i].control && !columns[i].never && display[i] === false) {
400
497
  showControl = true;
401
498
  break;
402
499
  }
403
500
  }
404
501
 
405
- for ( i=0, ien=columns.length ; i<ien ; i++ ) {
406
- if ( columns[i].control ) {
502
+ for (i = 0, ien = columns.length; i < ien; i++) {
503
+ if (columns[i].control) {
407
504
  display[i] = showControl;
408
505
  }
409
506
 
410
507
  // Replace not visible string with false from the control column detection above
411
- if ( display[i] === 'not-visible' ) {
508
+ if (display[i] === 'not-visible') {
412
509
  display[i] = false;
413
510
  }
414
511
  }
415
512
 
416
513
  // Finally we need to make sure that there is at least one column that
417
514
  // is visible
418
- if ( $.inArray( true, display ) === -1 ) {
515
+ if ($.inArray(true, display) === -1) {
419
516
  display[0] = true;
420
517
  }
421
518
 
422
519
  return display;
423
520
  },
424
521
 
425
-
426
522
  /**
427
523
  * Create the internal `columns` array with information about the columns
428
524
  * for the table. This includes determining which breakpoints the column
@@ -431,76 +527,78 @@ $.extend( Responsive.prototype, {
431
527
  *
432
528
  * @private
433
529
  */
434
- _classLogic: function ()
435
- {
530
+ _classLogic: function () {
436
531
  var that = this;
437
532
  var calc = {};
438
533
  var breakpoints = this.c.breakpoints;
439
534
  var dt = this.s.dt;
440
- var columns = dt.columns().eq(0).map( function (i) {
441
- var column = this.column(i);
442
- var className = column.header().className;
443
- var priority = dt.settings()[0].aoColumns[i].responsivePriority;
444
-
445
- if ( priority === undefined ) {
446
- var dataPriority = $(column.header()).data('priority');
447
-
448
- priority = dataPriority !== undefined ?
449
- dataPriority * 1 :
450
- 10000;
451
- }
535
+ var columns = dt
536
+ .columns()
537
+ .eq(0)
538
+ .map(function (i) {
539
+ var column = this.column(i);
540
+ var className = column.header().className;
541
+ var priority = dt.settings()[0].aoColumns[i].responsivePriority;
542
+ var dataPriority = column.header().getAttribute('data-priority');
543
+
544
+ if (priority === undefined) {
545
+ priority =
546
+ dataPriority === undefined || dataPriority === null
547
+ ? 10000
548
+ : dataPriority * 1;
549
+ }
452
550
 
453
- return {
454
- className: className,
455
- includeIn: [],
456
- auto: false,
457
- control: false,
458
- never: className.match(/\bnever\b/) ? true : false,
459
- priority: priority
460
- };
461
- } );
551
+ return {
552
+ className: className,
553
+ includeIn: [],
554
+ auto: false,
555
+ control: false,
556
+ never: className.match(/\b(dtr\-)?never\b/) ? true : false,
557
+ priority: priority
558
+ };
559
+ });
462
560
 
463
561
  // Simply add a breakpoint to `includeIn` array, ensuring that there are
464
562
  // no duplicates
465
- var add = function ( colIdx, name ) {
466
- var includeIn = columns[ colIdx ].includeIn;
563
+ var add = function (colIdx, name) {
564
+ var includeIn = columns[colIdx].includeIn;
467
565
 
468
- if ( $.inArray( name, includeIn ) === -1 ) {
469
- includeIn.push( name );
566
+ if ($.inArray(name, includeIn) === -1) {
567
+ includeIn.push(name);
470
568
  }
471
569
  };
472
570
 
473
- var column = function ( colIdx, name, operator, matched ) {
571
+ var column = function (colIdx, name, operator, matched) {
474
572
  var size, i, ien;
475
573
 
476
- if ( ! operator ) {
477
- columns[ colIdx ].includeIn.push( name );
574
+ if (!operator) {
575
+ columns[colIdx].includeIn.push(name);
478
576
  }
479
- else if ( operator === 'max-' ) {
577
+ else if (operator === 'max-') {
480
578
  // Add this breakpoint and all smaller
481
- size = that._find( name ).width;
579
+ size = that._find(name).width;
482
580
 
483
- for ( i=0, ien=breakpoints.length ; i<ien ; i++ ) {
484
- if ( breakpoints[i].width <= size ) {
485
- add( colIdx, breakpoints[i].name );
581
+ for (i = 0, ien = breakpoints.length; i < ien; i++) {
582
+ if (breakpoints[i].width <= size) {
583
+ add(colIdx, breakpoints[i].name);
486
584
  }
487
585
  }
488
586
  }
489
- else if ( operator === 'min-' ) {
587
+ else if (operator === 'min-') {
490
588
  // Add this breakpoint and all larger
491
- size = that._find( name ).width;
589
+ size = that._find(name).width;
492
590
 
493
- for ( i=0, ien=breakpoints.length ; i<ien ; i++ ) {
494
- if ( breakpoints[i].width >= size ) {
495
- add( colIdx, breakpoints[i].name );
591
+ for (i = 0, ien = breakpoints.length; i < ien; i++) {
592
+ if (breakpoints[i].width >= size) {
593
+ add(colIdx, breakpoints[i].name);
496
594
  }
497
595
  }
498
596
  }
499
- else if ( operator === 'not-' ) {
597
+ else if (operator === 'not-') {
500
598
  // Add all but this breakpoint
501
- for ( i=0, ien=breakpoints.length ; i<ien ; i++ ) {
502
- if ( breakpoints[i].name.indexOf( matched ) === -1 ) {
503
- add( colIdx, breakpoints[i].name );
599
+ for (i = 0, ien = breakpoints.length; i < ien; i++) {
600
+ if (breakpoints[i].name.indexOf(matched) === -1) {
601
+ add(colIdx, breakpoints[i].name);
504
602
  }
505
603
  }
506
604
  }
@@ -508,28 +606,28 @@ $.extend( Responsive.prototype, {
508
606
 
509
607
  // Loop over each column and determine if it has a responsive control
510
608
  // class
511
- columns.each( function ( col, i ) {
609
+ columns.each(function (col, i) {
512
610
  var classNames = col.className.split(' ');
513
611
  var hasClass = false;
514
612
 
515
613
  // Split the class name up so multiple rules can be applied if needed
516
- for ( var k=0, ken=classNames.length ; k<ken ; k++ ) {
517
- var className = $.trim( classNames[k] );
614
+ for (var k = 0, ken = classNames.length; k < ken; k++) {
615
+ var className = classNames[k].trim();
518
616
 
519
- if ( className === 'all' ) {
617
+ if (className === 'all' || className === 'dtr-all') {
520
618
  // Include in all
521
619
  hasClass = true;
522
- col.includeIn = $.map( breakpoints, function (a) {
620
+ col.includeIn = $.map(breakpoints, function (a) {
523
621
  return a.name;
524
- } );
622
+ });
525
623
  return;
526
624
  }
527
- else if ( className === 'none' || col.never ) {
625
+ else if (className === 'none' || className === 'dtr-none' || col.never) {
528
626
  // Include in none (default) and no auto
529
627
  hasClass = true;
530
628
  return;
531
629
  }
532
- else if ( className === 'control' ) {
630
+ else if (className === 'control' || className === 'dtr-control') {
533
631
  // Special column that is only visible, when one of the other
534
632
  // columns is hidden. This is used for the details control
535
633
  hasClass = true;
@@ -537,36 +635,64 @@ $.extend( Responsive.prototype, {
537
635
  return;
538
636
  }
539
637
 
540
- $.each( breakpoints, function ( j, breakpoint ) {
638
+ $.each(breakpoints, function (j, breakpoint) {
541
639
  // Does this column have a class that matches this breakpoint?
542
640
  var brokenPoint = breakpoint.name.split('-');
543
- var re = new RegExp( '(min\\-|max\\-|not\\-)?('+brokenPoint[0]+')(\\-[_a-zA-Z0-9])?' );
544
- var match = className.match( re );
641
+ var re = new RegExp(
642
+ '(min\\-|max\\-|not\\-)?(' + brokenPoint[0] + ')(\\-[_a-zA-Z0-9])?'
643
+ );
644
+ var match = className.match(re);
545
645
 
546
- if ( match ) {
646
+ if (match) {
547
647
  hasClass = true;
548
648
 
549
- if ( match[2] === brokenPoint[0] && match[3] === '-'+brokenPoint[1] ) {
649
+ if (match[2] === brokenPoint[0] && match[3] === '-' + brokenPoint[1]) {
550
650
  // Class name matches breakpoint name fully
551
- column( i, breakpoint.name, match[1], match[2]+match[3] );
651
+ column(i, breakpoint.name, match[1], match[2] + match[3]);
552
652
  }
553
- else if ( match[2] === brokenPoint[0] && ! match[3] ) {
653
+ else if (match[2] === brokenPoint[0] && !match[3]) {
554
654
  // Class name matched primary breakpoint name with no qualifier
555
- column( i, breakpoint.name, match[1], match[2] );
655
+ column(i, breakpoint.name, match[1], match[2]);
556
656
  }
557
657
  }
558
- } );
658
+ });
559
659
  }
560
660
 
561
661
  // If there was no control class, then automatic sizing is used
562
- if ( ! hasClass ) {
662
+ if (!hasClass) {
563
663
  col.auto = true;
564
664
  }
565
- } );
665
+ });
566
666
 
567
667
  this.s.columns = columns;
568
668
  },
569
669
 
670
+ /**
671
+ * Update the cells to show the correct control class / button
672
+ * @private
673
+ */
674
+ _controlClass: function () {
675
+ if (this.c.details.type === 'inline') {
676
+ var dt = this.s.dt;
677
+ var columnsVis = this.s.current;
678
+ var firstVisible = $.inArray(true, columnsVis);
679
+
680
+ // Remove from any cells which shouldn't have it
681
+ dt.cells(
682
+ null,
683
+ function (idx) {
684
+ return idx !== firstVisible;
685
+ },
686
+ { page: 'current' }
687
+ )
688
+ .nodes()
689
+ .to$()
690
+ .filter('.dtr-control')
691
+ .removeClass('dtr-control');
692
+
693
+ dt.cells(null, firstVisible, { page: 'current' }).nodes().to$().addClass('dtr-control');
694
+ }
695
+ },
570
696
 
571
697
  /**
572
698
  * Show the details for the child row
@@ -575,133 +701,143 @@ $.extend( Responsive.prototype, {
575
701
  * @param {boolean} update Update flag
576
702
  * @private
577
703
  */
578
- _detailsDisplay: function ( row, update )
579
- {
704
+ _detailsDisplay: function (row, update) {
580
705
  var that = this;
581
706
  var dt = this.s.dt;
582
707
  var details = this.c.details;
708
+ var event = function (res) {
709
+ $(row.node()).toggleClass('parent', res !== false);
710
+ $(dt.table().node()).triggerHandler('responsive-display.dt', [dt, row, res, update]);
711
+ };
583
712
 
584
- if ( details && details.type !== false ) {
585
- var res = details.display( row, update, function () {
586
- return details.renderer(
587
- dt, row[0], that._detailsObj(row[0])
588
- );
589
- } );
713
+ if (details && details.type !== false) {
714
+ var renderer =
715
+ typeof details.renderer === 'string'
716
+ ? Responsive.renderer[details.renderer]()
717
+ : details.renderer;
718
+
719
+ var res = details.display(
720
+ row,
721
+ update,
722
+ function () {
723
+ return renderer.call(that, dt, row[0], that._detailsObj(row[0]));
724
+ },
725
+ function () {
726
+ event(false);
727
+ }
728
+ );
590
729
 
591
- if ( res === true || res === false ) {
592
- $(dt.table().node()).triggerHandler( 'responsive-display.dt', [dt, row, res, update] );
730
+ if (typeof res === 'boolean') {
731
+ event(res);
593
732
  }
594
733
  }
595
734
  },
596
735
 
597
-
598
736
  /**
599
737
  * Initialisation for the details handler
600
738
  *
601
739
  * @private
602
740
  */
603
- _detailsInit: function ()
604
- {
605
- var that = this;
606
- var dt = this.s.dt;
741
+ _detailsInit: function () {
742
+ var that = this;
743
+ var dt = this.s.dt;
607
744
  var details = this.c.details;
608
745
 
609
746
  // The inline type always uses the first child as the target
610
- if ( details.type === 'inline' ) {
611
- details.target = 'td:first-child, th:first-child';
747
+ if (details.type === 'inline') {
748
+ details.target = 'td.dtr-control, th.dtr-control';
612
749
  }
613
750
 
614
751
  // Keyboard accessibility
615
- dt.on( 'draw.dtr', function () {
752
+ dt.on('draw.dtr', function () {
616
753
  that._tabIndexes();
617
- } );
754
+ });
618
755
  that._tabIndexes(); // Initial draw has already happened
619
756
 
620
- $( dt.table().body() ).on( 'keyup.dtr', 'td, th', function (e) {
621
- if ( e.keyCode === 13 && $(this).data('dtr-keyboard') ) {
757
+ $(dt.table().body()).on('keyup.dtr', 'td, th', function (e) {
758
+ if (e.keyCode === 13 && $(this).data('dtr-keyboard')) {
622
759
  $(this).click();
623
760
  }
624
- } );
761
+ });
625
762
 
626
763
  // type.target can be a string jQuery selector or a column index
627
- var target = details.target;
764
+ var target = details.target;
628
765
  var selector = typeof target === 'string' ? target : 'td, th';
629
766
 
630
- // Click handler to show / hide the details rows when they are available
631
- $( dt.table().body() )
632
- .on( 'click.dtr mousedown.dtr mouseup.dtr', selector, function (e) {
767
+ if (target !== undefined || target !== null) {
768
+ // Click handler to show / hide the details rows when they are available
769
+ $(dt.table().body()).on('click.dtr mousedown.dtr mouseup.dtr', selector, function (e) {
633
770
  // If the table is not collapsed (i.e. there is no hidden columns)
634
771
  // then take no action
635
- if ( ! $(dt.table().node()).hasClass('collapsed' ) ) {
772
+ if (!$(dt.table().node()).hasClass('collapsed')) {
636
773
  return;
637
774
  }
638
775
 
639
776
  // Check that the row is actually a DataTable's controlled node
640
- if ( $.inArray( $(this).closest('tr').get(0), dt.rows().nodes().toArray() ) === -1 ) {
777
+ if ($.inArray($(this).closest('tr').get(0), dt.rows().nodes().toArray()) === -1) {
641
778
  return;
642
779
  }
643
780
 
644
781
  // For column index, we determine if we should act or not in the
645
782
  // handler - otherwise it is already okay
646
- if ( typeof target === 'number' ) {
647
- var targetIdx = target < 0 ?
648
- dt.columns().eq(0).length + target :
649
- target;
783
+ if (typeof target === 'number') {
784
+ var targetIdx = target < 0 ? dt.columns().eq(0).length + target : target;
650
785
 
651
- if ( dt.cell( this ).index().column !== targetIdx ) {
786
+ if (dt.cell(this).index().column !== targetIdx) {
652
787
  return;
653
788
  }
654
789
  }
655
790
 
656
791
  // $().closest() includes itself in its check
657
- var row = dt.row( $(this).closest('tr') );
792
+ var row = dt.row($(this).closest('tr'));
658
793
 
659
794
  // Check event type to do an action
660
- if ( e.type === 'click' ) {
795
+ if (e.type === 'click') {
661
796
  // The renderer is given as a function so the caller can execute it
662
797
  // only when they need (i.e. if hiding there is no point is running
663
798
  // the renderer)
664
- that._detailsDisplay( row, false );
799
+ that._detailsDisplay(row, false);
665
800
  }
666
- else if ( e.type === 'mousedown' ) {
801
+ else if (e.type === 'mousedown') {
667
802
  // For mouse users, prevent the focus ring from showing
668
803
  $(this).css('outline', 'none');
669
804
  }
670
- else if ( e.type === 'mouseup' ) {
805
+ else if (e.type === 'mouseup') {
671
806
  // And then re-allow at the end of the click
672
- $(this).blur().css('outline', '');
807
+ $(this).trigger('blur').css('outline', '');
673
808
  }
674
- } );
809
+ });
810
+ }
675
811
  },
676
812
 
677
-
678
813
  /**
679
814
  * Get the details to pass to a renderer for a row
680
815
  * @param {int} rowIdx Row index
681
816
  * @private
682
817
  */
683
- _detailsObj: function ( rowIdx )
684
- {
818
+ _detailsObj: function (rowIdx) {
685
819
  var that = this;
686
820
  var dt = this.s.dt;
687
821
 
688
- return $.map( this.s.columns, function( col, i ) {
822
+ return $.map(this.s.columns, function (col, i) {
689
823
  // Never and control columns should not be passed to the renderer
690
- if ( col.never || col.control ) {
824
+ if (col.never || col.control) {
691
825
  return;
692
826
  }
693
827
 
828
+ var dtCol = dt.settings()[0].aoColumns[i];
829
+
694
830
  return {
695
- title: dt.settings()[0].aoColumns[ i ].sTitle,
696
- data: dt.cell( rowIdx, i ).render( that.c.orthogonal ),
697
- hidden: dt.column( i ).visible() && !that.s.current[ i ],
831
+ className: dtCol.sClass,
698
832
  columnIndex: i,
699
- rowIndex: rowIdx
833
+ data: dt.cell(rowIdx, i).render(that.c.orthogonal),
834
+ hidden: dt.column(i).visible() && !that.s.current[i],
835
+ rowIndex: rowIdx,
836
+ title: dtCol.sTitle !== null ? dtCol.sTitle : $(dt.column(i).header()).text()
700
837
  };
701
- } );
838
+ });
702
839
  },
703
840
 
704
-
705
841
  /**
706
842
  * Find a breakpoint object from a name
707
843
  *
@@ -709,49 +845,43 @@ $.extend( Responsive.prototype, {
709
845
  * @return {object} Breakpoint description object
710
846
  * @private
711
847
  */
712
- _find: function ( name )
713
- {
848
+ _find: function (name) {
714
849
  var breakpoints = this.c.breakpoints;
715
850
 
716
- for ( var i=0, ien=breakpoints.length ; i<ien ; i++ ) {
717
- if ( breakpoints[i].name === name ) {
851
+ for (var i = 0, ien = breakpoints.length; i < ien; i++) {
852
+ if (breakpoints[i].name === name) {
718
853
  return breakpoints[i];
719
854
  }
720
855
  }
721
856
  },
722
857
 
723
-
724
858
  /**
725
859
  * Re-create the contents of the child rows as the display has changed in
726
860
  * some way.
727
861
  *
728
862
  * @private
729
863
  */
730
- _redrawChildren: function ()
731
- {
864
+ _redrawChildren: function () {
732
865
  var that = this;
733
866
  var dt = this.s.dt;
734
867
 
735
- dt.rows( {page: 'current'} ).iterator( 'row', function ( settings, idx ) {
736
- var row = dt.row( idx );
737
-
738
- that._detailsDisplay( dt.row( idx ), true );
739
- } );
868
+ dt.rows({ page: 'current' }).iterator('row', function (settings, idx) {
869
+ that._detailsDisplay(dt.row(idx), true);
870
+ });
740
871
  },
741
872
 
742
-
743
873
  /**
744
874
  * Alter the table display for a resized viewport. This involves first
745
875
  * determining what breakpoint the window currently is in, getting the
746
876
  * column visibilities to apply and then setting them.
747
877
  *
878
+ * @param {boolean} forceRedraw Force a redraw
748
879
  * @private
749
880
  */
750
- _resize: function ()
751
- {
881
+ _resize: function (forceRedraw) {
752
882
  var that = this;
753
883
  var dt = this.s.dt;
754
- var width = $(window).width();
884
+ var width = $(window).innerWidth();
755
885
  var breakpoints = this.c.breakpoints;
756
886
  var breakpoint = breakpoints[0].name;
757
887
  var columns = this.s.columns;
@@ -759,57 +889,68 @@ $.extend( Responsive.prototype, {
759
889
  var oldVis = this.s.current.slice();
760
890
 
761
891
  // Determine what breakpoint we are currently at
762
- for ( i=breakpoints.length-1 ; i>=0 ; i-- ) {
763
- if ( width <= breakpoints[i].width ) {
892
+ for (i = breakpoints.length - 1; i >= 0; i--) {
893
+ if (width <= breakpoints[i].width) {
764
894
  breakpoint = breakpoints[i].name;
765
895
  break;
766
896
  }
767
897
  }
768
898
 
769
899
  // Show the columns for that break point
770
- var columnsVis = this._columnsVisiblity( breakpoint );
900
+ var columnsVis = this._columnsVisiblity(breakpoint);
771
901
  this.s.current = columnsVis;
772
902
 
773
903
  // Set the class before the column visibility is changed so event
774
904
  // listeners know what the state is. Need to determine if there are
775
905
  // any columns that are not visible but can be shown
776
906
  var collapsedClass = false;
777
- for ( i=0, ien=columns.length ; i<ien ; i++ ) {
778
- if ( columnsVis[i] === false && ! columns[i].never && ! columns[i].control && ! dt.column(i).visible() === false ) {
907
+
908
+ for (i = 0, ien = columns.length; i < ien; i++) {
909
+ if (
910
+ columnsVis[i] === false &&
911
+ !columns[i].never &&
912
+ !columns[i].control &&
913
+ !dt.column(i).visible() === false
914
+ ) {
779
915
  collapsedClass = true;
780
916
  break;
781
917
  }
782
918
  }
783
919
 
784
- $( dt.table().node() ).toggleClass( 'collapsed', collapsedClass );
920
+ $(dt.table().node()).toggleClass('collapsed', collapsedClass);
785
921
 
786
922
  var changed = false;
787
923
  var visible = 0;
788
924
 
789
- dt.columns().eq(0).each( function ( colIdx, i ) {
790
- if ( columnsVis[i] === true ) {
791
- visible++;
792
- }
925
+ dt.columns()
926
+ .eq(0)
927
+ .each(function (colIdx, i) {
928
+ if (columnsVis[i] === true) {
929
+ visible++;
930
+ }
793
931
 
794
- if ( columnsVis[i] !== oldVis[i] ) {
795
- changed = true;
796
- that._setColumnVis( colIdx, columnsVis[i] );
797
- }
798
- } );
932
+ if (forceRedraw || columnsVis[i] !== oldVis[i]) {
933
+ changed = true;
934
+ that._setColumnVis(colIdx, columnsVis[i]);
935
+ }
936
+ });
799
937
 
800
- if ( changed ) {
801
- this._redrawChildren();
938
+ // Always need to update the display, regardless of if it has changed or not, so nodes
939
+ // can be re-inserted for listHiddenNodes
940
+ this._redrawChildren();
802
941
 
942
+ if (changed) {
803
943
  // Inform listeners of the change
804
- $(dt.table().node()).trigger( 'responsive-resize.dt', [dt, this.s.current] );
944
+ $(dt.table().node()).trigger('responsive-resize.dt', [dt, this.s.current]);
805
945
 
806
946
  // If no records, update the "No records" display element
807
- if ( dt.page.info().recordsDisplay === 0 ) {
947
+ if (dt.page.info().recordsDisplay === 0) {
808
948
  $('td', dt.table().body()).eq(0).attr('colspan', visible);
809
949
  }
810
950
  }
811
- },
812
951
 
952
+ that._controlClass();
953
+ },
813
954
 
814
955
  /**
815
956
  * Determine the width of each column in the table so the auto column hiding
@@ -819,113 +960,138 @@ $.extend( Responsive.prototype, {
819
960
  *
820
961
  * @private
821
962
  */
822
- _resizeAuto: function ()
823
- {
963
+ _resizeAuto: function () {
824
964
  var dt = this.s.dt;
825
965
  var columns = this.s.columns;
966
+ var that = this;
826
967
 
827
968
  // Are we allowed to do auto sizing?
828
- if ( ! this.c.auto ) {
969
+ if (!this.c.auto) {
829
970
  return;
830
971
  }
831
972
 
832
973
  // Are there any columns that actually need auto-sizing, or do they all
833
974
  // have classes defined
834
- if ( $.inArray( true, $.map( columns, function (c) { return c.auto; } ) ) === -1 ) {
975
+ if (
976
+ $.inArray(
977
+ true,
978
+ $.map(columns, function (c) {
979
+ return c.auto;
980
+ })
981
+ ) === -1
982
+ ) {
835
983
  return;
836
984
  }
837
985
 
838
986
  // Need to restore all children. They will be reinstated by a re-render
839
- if ( ! $.isEmptyObject( _childNodeStore ) ) {
840
- $.each( _childNodeStore, function ( key ) {
987
+ if (!$.isEmptyObject(this.s.childNodeStore)) {
988
+ $.each(this.s.childNodeStore, function (key) {
841
989
  var idx = key.split('-');
842
990
 
843
- _childNodesRestore( dt, idx[0]*1, idx[1]*1 );
844
- } );
991
+ that._childNodesRestore(dt, idx[0] * 1, idx[1] * 1);
992
+ });
845
993
  }
846
994
 
847
995
  // Clone the table with the current data in it
848
- var tableWidth = dt.table().node().offsetWidth;
996
+ var tableWidth = dt.table().node().offsetWidth;
849
997
  var columnWidths = dt.columns;
850
- var clonedTable = dt.table().node().cloneNode( false );
851
- var clonedHeader = $( dt.table().header().cloneNode( false ) ).appendTo( clonedTable );
852
- var clonedBody = $( dt.table().body() ).clone( false, false ).empty().appendTo( clonedTable ); // use jQuery because of IE8
998
+ var clonedTable = dt.table().node().cloneNode(false);
999
+ var clonedHeader = $(dt.table().header().cloneNode(false)).appendTo(clonedTable);
1000
+ var clonedBody = $(dt.table().body()).clone(false, false).empty().appendTo(clonedTable); // use jQuery because of IE8
1001
+
1002
+ clonedTable.style.width = 'auto';
853
1003
 
854
1004
  // Header
855
- var headerCells = dt.columns()
1005
+ var headerCells = dt
1006
+ .columns()
856
1007
  .header()
857
- .filter( function (idx) {
1008
+ .filter(function (idx) {
858
1009
  return dt.column(idx).visible();
859
- } )
1010
+ })
860
1011
  .to$()
861
- .clone( false )
862
- .css( 'display', 'table-cell' )
863
- .css( 'min-width', 0 );
1012
+ .clone(false)
1013
+ .css('display', 'table-cell')
1014
+ .css('width', 'auto')
1015
+ .css('min-width', 0);
864
1016
 
865
1017
  // Body rows - we don't need to take account of DataTables' column
866
1018
  // visibility since we implement our own here (hence the `display` set)
867
1019
  $(clonedBody)
868
- .append( $(dt.rows( { page: 'current' } ).nodes()).clone( false ) )
869
- .find( 'th, td' ).css( 'display', '' );
1020
+ .append($(dt.rows({ page: 'current' }).nodes()).clone(false))
1021
+ .find('th, td')
1022
+ .css('display', '');
870
1023
 
871
1024
  // Footer
872
1025
  var footer = dt.table().footer();
873
- if ( footer ) {
874
- var clonedFooter = $( footer.cloneNode( false ) ).appendTo( clonedTable );
875
- var footerCells = dt.columns()
1026
+ if (footer) {
1027
+ var clonedFooter = $(footer.cloneNode(false)).appendTo(clonedTable);
1028
+ var footerCells = dt
1029
+ .columns()
876
1030
  .footer()
877
- .filter( function (idx) {
1031
+ .filter(function (idx) {
878
1032
  return dt.column(idx).visible();
879
- } )
1033
+ })
880
1034
  .to$()
881
- .clone( false )
882
- .css( 'display', 'table-cell' );
1035
+ .clone(false)
1036
+ .css('display', 'table-cell');
883
1037
 
884
- $('<tr/>')
885
- .append( footerCells )
886
- .appendTo( clonedFooter );
1038
+ $('<tr/>').append(footerCells).appendTo(clonedFooter);
887
1039
  }
888
1040
 
889
- $('<tr/>')
890
- .append( headerCells )
891
- .appendTo( clonedHeader );
1041
+ $('<tr/>').append(headerCells).appendTo(clonedHeader);
892
1042
 
893
1043
  // In the inline case extra padding is applied to the first column to
894
1044
  // give space for the show / hide icon. We need to use this in the
895
1045
  // calculation
896
- if ( this.c.details.type === 'inline' ) {
897
- $(clonedTable).addClass( 'dtr-inline collapsed' );
1046
+ if (this.c.details.type === 'inline') {
1047
+ $(clonedTable).addClass('dtr-inline collapsed');
898
1048
  }
899
1049
 
900
1050
  // It is unsafe to insert elements with the same name into the DOM
901
1051
  // multiple times. For example, cloning and inserting a checked radio
902
1052
  // clears the chcecked state of the original radio.
903
- $( clonedTable ).find( '[name]' ).removeAttr( 'name' );
1053
+ $(clonedTable).find('[name]').removeAttr('name');
904
1054
 
905
1055
  // A position absolute table would take the table out of the flow of
906
1056
  // our container element, bypassing the height and width (Scroller)
907
- $( clonedTable ).css( 'position', 'relative' )
1057
+ $(clonedTable).css('position', 'relative');
908
1058
 
909
1059
  var inserted = $('<div/>')
910
- .css( {
1060
+ .css({
911
1061
  width: 1,
912
1062
  height: 1,
913
1063
  overflow: 'hidden',
914
1064
  clear: 'both'
915
- } )
916
- .append( clonedTable );
1065
+ })
1066
+ .append(clonedTable);
917
1067
 
918
- inserted.insertBefore( dt.table().node() );
1068
+ inserted.insertBefore(dt.table().node());
919
1069
 
920
1070
  // The cloned header now contains the smallest that each column can be
921
- headerCells.each( function (i) {
922
- var idx = dt.column.index( 'fromVisible', i );
923
- columns[ idx ].minWidth = this.offsetWidth || 0;
924
- } );
1071
+ headerCells.each(function (i) {
1072
+ var idx = dt.column.index('fromVisible', i);
1073
+ columns[idx].minWidth = this.offsetWidth || 0;
1074
+ });
925
1075
 
926
1076
  inserted.remove();
927
1077
  },
928
1078
 
1079
+ /**
1080
+ * Get the state of the current hidden columns - controlled by Responsive only
1081
+ */
1082
+ _responsiveOnlyHidden: function () {
1083
+ var dt = this.s.dt;
1084
+
1085
+ return $.map(this.s.current, function (v, i) {
1086
+ // If the column is hidden by DataTables then it can't be hidden by
1087
+ // Responsive!
1088
+ if (dt.column(i).visible() === false) {
1089
+ return true;
1090
+ }
1091
+ return v;
1092
+ });
1093
+ },
1094
+
929
1095
  /**
930
1096
  * Set a column's visibility.
931
1097
  *
@@ -938,24 +1104,27 @@ $.extend( Responsive.prototype, {
938
1104
  * @param {boolean} showHide Show or hide (true or false)
939
1105
  * @private
940
1106
  */
941
- _setColumnVis: function ( col, showHide )
942
- {
1107
+ _setColumnVis: function (col, showHide) {
1108
+ var that = this;
943
1109
  var dt = this.s.dt;
944
1110
  var display = showHide ? '' : 'none'; // empty string will remove the attr
945
1111
 
946
- $( dt.column( col ).header() ).css( 'display', display );
947
- $( dt.column( col ).footer() ).css( 'display', display );
948
- dt.column( col ).nodes().to$().css( 'display', display );
1112
+ $(dt.column(col).header()).css('display', display).toggleClass('dtr-hidden', !showHide);
1113
+
1114
+ $(dt.column(col).footer()).css('display', display).toggleClass('dtr-hidden', !showHide);
1115
+
1116
+ dt.column(col).nodes().to$().css('display', display).toggleClass('dtr-hidden', !showHide);
949
1117
 
950
1118
  // If the are child nodes stored, we might need to reinsert them
951
- if ( ! $.isEmptyObject( _childNodeStore ) ) {
952
- dt.cells( null, col ).indexes().each( function (idx) {
953
- _childNodesRestore( dt, idx.row, idx.column );
954
- } );
1119
+ if (!$.isEmptyObject(this.s.childNodeStore)) {
1120
+ dt.cells(null, col)
1121
+ .indexes()
1122
+ .each(function (idx) {
1123
+ that._childNodesRestore(dt, idx.row, idx.column);
1124
+ });
955
1125
  }
956
1126
  },
957
1127
 
958
-
959
1128
  /**
960
1129
  * Update the cell tab indexes for keyboard accessibility. This is called on
961
1130
  * every table draw - that is potentially inefficient, but also the least
@@ -965,34 +1134,34 @@ $.extend( Responsive.prototype, {
965
1134
  *
966
1135
  * @private
967
1136
  */
968
- _tabIndexes: function ()
969
- {
1137
+ _tabIndexes: function () {
970
1138
  var dt = this.s.dt;
971
- var cells = dt.cells( { page: 'current' } ).nodes().to$();
1139
+ var cells = dt.cells({ page: 'current' }).nodes().to$();
972
1140
  var ctx = dt.settings()[0];
973
1141
  var target = this.c.details.target;
974
1142
 
975
- cells.filter( '[data-dtr-keyboard]' ).removeData( '[data-dtr-keyboard]' );
1143
+ cells.filter('[data-dtr-keyboard]').removeData('[data-dtr-keyboard]');
976
1144
 
977
- if ( typeof target === 'number' ) {
978
- dt.cells( null, target, { page: 'current' } ).nodes().to$()
979
- .attr( 'tabIndex', ctx.iTabIndex )
980
- .data( 'dtr-keyboard', 1 );
1145
+ if (typeof target === 'number') {
1146
+ dt.cells(null, target, { page: 'current' })
1147
+ .nodes()
1148
+ .to$()
1149
+ .attr('tabIndex', ctx.iTabIndex)
1150
+ .data('dtr-keyboard', 1);
981
1151
  }
982
1152
  else {
983
1153
  // This is a bit of a hack - we need to limit the selected nodes to just
984
1154
  // those of this table
985
- if ( target === 'td:first-child, th:first-child' ) {
1155
+ if (target === 'td:first-child, th:first-child') {
986
1156
  target = '>td:first-child, >th:first-child';
987
1157
  }
988
1158
 
989
- $( target, dt.rows( { page: 'current' } ).nodes() )
990
- .attr( 'tabIndex', ctx.iTabIndex )
991
- .data( 'dtr-keyboard', 1 );
1159
+ $(target, dt.rows({ page: 'current' }).nodes())
1160
+ .attr('tabIndex', ctx.iTabIndex)
1161
+ .data('dtr-keyboard', 1);
992
1162
  }
993
1163
  }
994
- } );
995
-
1164
+ });
996
1165
 
997
1166
  /**
998
1167
  * List of default breakpoints. Each item in the array is an object with two
@@ -1005,14 +1174,13 @@ $.extend( Responsive.prototype, {
1005
1174
  * @static
1006
1175
  */
1007
1176
  Responsive.breakpoints = [
1008
- { name: 'desktop', width: Infinity },
1177
+ { name: 'desktop', width: Infinity },
1009
1178
  { name: 'tablet-l', width: 1024 },
1010
1179
  { name: 'tablet-p', width: 768 },
1011
1180
  { name: 'mobile-l', width: 480 },
1012
1181
  { name: 'mobile-p', width: 320 }
1013
1182
  ];
1014
1183
 
1015
-
1016
1184
  /**
1017
1185
  * Display methods - functions which define how the hidden data should be shown
1018
1186
  * in the table.
@@ -1022,42 +1190,38 @@ Responsive.breakpoints = [
1022
1190
  * @static
1023
1191
  */
1024
1192
  Responsive.display = {
1025
- childRow: function ( row, update, render ) {
1026
- if ( update ) {
1027
- if ( $(row.node()).hasClass('parent') ) {
1028
- row.child( render(), 'child' ).show();
1193
+ childRow: function (row, update, render) {
1194
+ if (update) {
1195
+ if ($(row.node()).hasClass('parent')) {
1196
+ row.child(render(), 'child').show();
1029
1197
 
1030
1198
  return true;
1031
1199
  }
1032
1200
  }
1033
1201
  else {
1034
- if ( ! row.child.isShown() ) {
1035
- row.child( render(), 'child' ).show();
1036
- $( row.node() ).addClass( 'parent' );
1202
+ if (!row.child.isShown()) {
1203
+ row.child(render(), 'child').show();
1037
1204
 
1038
1205
  return true;
1039
1206
  }
1040
1207
  else {
1041
- row.child( false );
1042
- $( row.node() ).removeClass( 'parent' );
1208
+ row.child(false);
1043
1209
 
1044
1210
  return false;
1045
1211
  }
1046
1212
  }
1047
1213
  },
1048
1214
 
1049
- childRowImmediate: function ( row, update, render ) {
1050
- if ( (! update && row.child.isShown()) || ! row.responsive.hasHidden() ) {
1215
+ childRowImmediate: function (row, update, render) {
1216
+ if ((!update && row.child.isShown()) || !row.responsive.hasHidden()) {
1051
1217
  // User interaction and the row is show, or nothing to show
1052
- row.child( false );
1053
- $( row.node() ).removeClass( 'parent' );
1218
+ row.child(false);
1054
1219
 
1055
1220
  return false;
1056
1221
  }
1057
1222
  else {
1058
1223
  // Display
1059
- row.child( render(), 'child' ).show();
1060
- $( row.node() ).addClass( 'parent' );
1224
+ row.child(render(), 'child').show();
1061
1225
 
1062
1226
  return true;
1063
1227
  }
@@ -1066,103 +1230,70 @@ Responsive.display = {
1066
1230
  // This is a wrapper so the modal options for Bootstrap and jQuery UI can
1067
1231
  // have options passed into them. This specific one doesn't need to be a
1068
1232
  // function but it is for consistency in the `modal` name
1069
- modal: function ( options ) {
1070
- return function ( row, update, render ) {
1071
- if ( ! update ) {
1233
+ modal: function (options) {
1234
+ return function (row, update, render, closeCallback) {
1235
+ if (!update) {
1072
1236
  // Show a modal
1073
1237
  var close = function () {
1074
1238
  modal.remove(); // will tidy events for us
1075
- $(document).off( 'keypress.dtr' );
1239
+ $(document).off('keypress.dtr');
1240
+ $(row.node()).removeClass('parent');
1241
+
1242
+ closeCallback();
1076
1243
  };
1077
1244
 
1078
1245
  var modal = $('<div class="dtr-modal"/>')
1079
- .append( $('<div class="dtr-modal-display"/>')
1080
- .append( $('<div class="dtr-modal-content"/>')
1081
- .append( render() )
1082
- )
1083
- .append( $('<div class="dtr-modal-close">&times;</div>' )
1084
- .click( function () {
1085
- close();
1086
- } )
1087
- )
1246
+ .append(
1247
+ $('<div class="dtr-modal-display"/>')
1248
+ .append(
1249
+ $('<div class="dtr-modal-content"/>')
1250
+ .data('dtr-row-idx', row.index())
1251
+ .append(render())
1252
+ )
1253
+ .append(
1254
+ $('<div class="dtr-modal-close">&times;</div>').click(function () {
1255
+ close();
1256
+ })
1257
+ )
1088
1258
  )
1089
- .append( $('<div class="dtr-modal-background"/>')
1090
- .click( function () {
1259
+ .append(
1260
+ $('<div class="dtr-modal-background"/>').click(function () {
1091
1261
  close();
1092
- } )
1262
+ })
1093
1263
  )
1094
- .appendTo( 'body' );
1264
+ .appendTo('body');
1265
+
1266
+ $(row.node()).addClass('parent');
1095
1267
 
1096
- $(document).on( 'keyup.dtr', function (e) {
1097
- if ( e.keyCode === 27 ) {
1268
+ $(document).on('keyup.dtr', function (e) {
1269
+ if (e.keyCode === 27) {
1098
1270
  e.stopPropagation();
1099
1271
 
1100
1272
  close();
1101
1273
  }
1102
- } );
1274
+ });
1103
1275
  }
1104
1276
  else {
1105
- $('div.dtr-modal-content')
1106
- .empty()
1107
- .append( render() );
1277
+ var modal = $('div.dtr-modal-content');
1278
+
1279
+ if (modal.length && row.index() === modal.data('dtr-row-idx')) {
1280
+ modal.empty().append(render());
1281
+ }
1282
+ else {
1283
+ // Modal not shown, nothing to update
1284
+ return null;
1285
+ }
1108
1286
  }
1109
1287
 
1110
- if ( options && options.header ) {
1111
- $('div.dtr-modal-content').prepend(
1112
- '<h2>'+options.header( row )+'</h2>'
1113
- );
1288
+ if (options && options.header) {
1289
+ $('div.dtr-modal-content').prepend('<h2>' + options.header(row) + '</h2>');
1114
1290
  }
1291
+
1292
+ return true;
1115
1293
  };
1116
1294
  }
1117
1295
  };
1118
1296
 
1119
-
1120
- var _childNodeStore = {};
1121
-
1122
- function _childNodes( dt, row, col ) {
1123
- var name = row+'-'+col;
1124
-
1125
- if ( _childNodeStore[ name ] ) {
1126
- return _childNodeStore[ name ];
1127
- }
1128
-
1129
- // https://jsperf.com/childnodes-array-slice-vs-loop
1130
- var nodes = [];
1131
- var children = dt.cell( row, col ).node().childNodes;
1132
- for ( var i=0, ien=children.length ; i<ien ; i++ ) {
1133
- nodes.push( children[i] );
1134
- }
1135
-
1136
- _childNodeStore[ name ] = nodes;
1137
-
1138
- return nodes;
1139
- }
1140
-
1141
- function _childNodesRestore( dt, row, col ) {
1142
- var name = row+'-'+col;
1143
-
1144
- if ( ! _childNodeStore[ name ] ) {
1145
- return;
1146
- }
1147
-
1148
- var node = dt.cell( row, col ).node();
1149
- var store = _childNodeStore[ name ];
1150
- var parent = store[0].parentNode;
1151
- var parentChildren = parent.childNodes;
1152
- var a = [];
1153
-
1154
- for ( var i=0, ien=parentChildren.length ; i<ien ; i++ ) {
1155
- a.push( parentChildren[i] );
1156
- }
1157
-
1158
- for ( var j=0, jen=a.length ; j<jen ; j++ ) {
1159
- node.appendChild( a[j] );
1160
- }
1161
-
1162
- _childNodeStore[ name ] = undefined;
1163
- }
1164
-
1165
-
1166
1297
  /**
1167
1298
  * Display methods - functions which define how the hidden data should be shown
1168
1299
  * in the table.
@@ -1173,68 +1304,111 @@ function _childNodesRestore( dt, row, col ) {
1173
1304
  */
1174
1305
  Responsive.renderer = {
1175
1306
  listHiddenNodes: function () {
1176
- return function ( api, rowIdx, columns ) {
1177
- var ul = $('<ul data-dtr-index="'+rowIdx+'" class="dtr-details"/>');
1307
+ return function (api, rowIdx, columns) {
1308
+ var that = this;
1309
+ var ul = $('<ul data-dtr-index="' + rowIdx + '" class="dtr-details"/>');
1178
1310
  var found = false;
1179
1311
 
1180
- var data = $.each( columns, function ( i, col ) {
1181
- if ( col.hidden ) {
1312
+ var data = $.each(columns, function (i, col) {
1313
+ if (col.hidden) {
1314
+ var klass = col.className ? 'class="' + col.className + '"' : '';
1315
+
1182
1316
  $(
1183
- '<li data-dtr-index="'+col.columnIndex+'" data-dt-row="'+col.rowIndex+'" data-dt-column="'+col.columnIndex+'">'+
1184
- '<span class="dtr-title">'+
1185
- col.title+
1186
- '</span> '+
1187
- '</li>'
1317
+ '<li ' +
1318
+ klass +
1319
+ ' data-dtr-index="' +
1320
+ col.columnIndex +
1321
+ '" data-dt-row="' +
1322
+ col.rowIndex +
1323
+ '" data-dt-column="' +
1324
+ col.columnIndex +
1325
+ '">' +
1326
+ '<span class="dtr-title">' +
1327
+ col.title +
1328
+ '</span> ' +
1329
+ '</li>'
1188
1330
  )
1189
- .append( $('<span class="dtr-data"/>').append( _childNodes( api, col.rowIndex, col.columnIndex ) ) )// api.cell( col.rowIndex, col.columnIndex ).node().childNodes ) )
1190
- .appendTo( ul );
1331
+ .append(
1332
+ $('<span class="dtr-data"/>').append(
1333
+ that._childNodes(api, col.rowIndex, col.columnIndex)
1334
+ )
1335
+ ) // api.cell( col.rowIndex, col.columnIndex ).node().childNodes ) )
1336
+ .appendTo(ul);
1191
1337
 
1192
1338
  found = true;
1193
1339
  }
1194
- } );
1340
+ });
1195
1341
 
1196
- return found ?
1197
- ul :
1198
- false;
1342
+ return found ? ul : false;
1199
1343
  };
1200
1344
  },
1201
1345
 
1202
1346
  listHidden: function () {
1203
- return function ( api, rowIdx, columns ) {
1204
- var data = $.map( columns, function ( col ) {
1205
- return col.hidden ?
1206
- '<li data-dtr-index="'+col.columnIndex+'" data-dt-row="'+col.rowIndex+'" data-dt-column="'+col.columnIndex+'">'+
1207
- '<span class="dtr-title">'+
1208
- col.title+
1209
- '</span> '+
1210
- '<span class="dtr-data">'+
1211
- col.data+
1212
- '</span>'+
1213
- '</li>' :
1214
- '';
1215
- } ).join('');
1216
-
1217
- return data ?
1218
- $('<ul data-dtr-index="'+rowIdx+'" class="dtr-details"/>').append( data ) :
1219
- false;
1220
- }
1347
+ return function (api, rowIdx, columns) {
1348
+ var data = $.map(columns, function (col) {
1349
+ var klass = col.className ? 'class="' + col.className + '"' : '';
1350
+
1351
+ return col.hidden
1352
+ ? '<li ' +
1353
+ klass +
1354
+ ' data-dtr-index="' +
1355
+ col.columnIndex +
1356
+ '" data-dt-row="' +
1357
+ col.rowIndex +
1358
+ '" data-dt-column="' +
1359
+ col.columnIndex +
1360
+ '">' +
1361
+ '<span class="dtr-title">' +
1362
+ col.title +
1363
+ '</span> ' +
1364
+ '<span class="dtr-data">' +
1365
+ col.data +
1366
+ '</span>' +
1367
+ '</li>'
1368
+ : '';
1369
+ }).join('');
1370
+
1371
+ return data
1372
+ ? $('<ul data-dtr-index="' + rowIdx + '" class="dtr-details"/>').append(data)
1373
+ : false;
1374
+ };
1221
1375
  },
1222
1376
 
1223
- tableAll: function ( options ) {
1224
- options = $.extend( {
1225
- tableClass: ''
1226
- }, options );
1227
-
1228
- return function ( api, rowIdx, columns ) {
1229
- var data = $.map( columns, function ( col ) {
1230
- return '<tr data-dt-row="'+col.rowIndex+'" data-dt-column="'+col.columnIndex+'">'+
1231
- '<td>'+col.title+':'+'</td> '+
1232
- '<td>'+col.data+'</td>'+
1233
- '</tr>';
1234
- } ).join('');
1377
+ tableAll: function (options) {
1378
+ options = $.extend(
1379
+ {
1380
+ tableClass: ''
1381
+ },
1382
+ options
1383
+ );
1384
+
1385
+ return function (api, rowIdx, columns) {
1386
+ var data = $.map(columns, function (col) {
1387
+ var klass = col.className ? 'class="' + col.className + '"' : '';
1388
+
1389
+ return (
1390
+ '<tr ' +
1391
+ klass +
1392
+ ' data-dt-row="' +
1393
+ col.rowIndex +
1394
+ '" data-dt-column="' +
1395
+ col.columnIndex +
1396
+ '">' +
1397
+ '<td>' +
1398
+ col.title +
1399
+ ':' +
1400
+ '</td> ' +
1401
+ '<td>' +
1402
+ col.data +
1403
+ '</td>' +
1404
+ '</tr>'
1405
+ );
1406
+ }).join('');
1235
1407
 
1236
- return $('<table class="'+options.tableClass+' dtr-details" width="100%"/>').append( data );
1237
- }
1408
+ return $('<table class="' + options.tableClass + ' dtr-details" width="100%"/>').append(
1409
+ data
1410
+ );
1411
+ };
1238
1412
  }
1239
1413
  };
1240
1414
 
@@ -1302,59 +1476,61 @@ Responsive.defaults = {
1302
1476
  orthogonal: 'display'
1303
1477
  };
1304
1478
 
1305
-
1306
1479
  /*
1307
1480
  * API
1308
1481
  */
1309
1482
  var Api = $.fn.dataTable.Api;
1310
1483
 
1311
1484
  // Doesn't do anything - work around for a bug in DT... Not documented
1312
- Api.register( 'responsive()', function () {
1485
+ Api.register('responsive()', function () {
1313
1486
  return this;
1314
- } );
1487
+ });
1315
1488
 
1316
- Api.register( 'responsive.index()', function ( li ) {
1489
+ Api.register('responsive.index()', function (li) {
1317
1490
  li = $(li);
1318
1491
 
1319
1492
  return {
1320
1493
  column: li.data('dtr-index'),
1321
- row: li.parent().data('dtr-index')
1494
+ row: li.parent().data('dtr-index')
1322
1495
  };
1323
- } );
1496
+ });
1324
1497
 
1325
- Api.register( 'responsive.rebuild()', function () {
1326
- return this.iterator( 'table', function ( ctx ) {
1327
- if ( ctx._responsive ) {
1498
+ Api.register('responsive.rebuild()', function () {
1499
+ return this.iterator('table', function (ctx) {
1500
+ if (ctx._responsive) {
1328
1501
  ctx._responsive._classLogic();
1329
1502
  }
1330
- } );
1331
- } );
1503
+ });
1504
+ });
1332
1505
 
1333
- Api.register( 'responsive.recalc()', function () {
1334
- return this.iterator( 'table', function ( ctx ) {
1335
- if ( ctx._responsive ) {
1506
+ Api.register('responsive.recalc()', function () {
1507
+ return this.iterator('table', function (ctx) {
1508
+ if (ctx._responsive) {
1336
1509
  ctx._responsive._resizeAuto();
1337
1510
  ctx._responsive._resize();
1338
1511
  }
1339
- } );
1340
- } );
1512
+ });
1513
+ });
1341
1514
 
1342
- Api.register( 'responsive.hasHidden()', function () {
1515
+ Api.register('responsive.hasHidden()', function () {
1343
1516
  var ctx = this.context[0];
1344
1517
 
1345
- return ctx._responsive ?
1346
- $.inArray( false, ctx._responsive.s.current ) !== -1 :
1347
- false;
1348
- } );
1349
-
1350
- Api.registerPlural( 'columns().responsiveHidden()', 'column().responsiveHidden()', function () {
1351
- return this.iterator( 'column', function ( settings, column ) {
1352
- return settings._responsive ?
1353
- settings._responsive.s.current[ column ] :
1354
- false;
1355
- }, 1 );
1356
- } );
1357
-
1518
+ return ctx._responsive
1519
+ ? $.inArray(false, ctx._responsive._responsiveOnlyHidden()) !== -1
1520
+ : false;
1521
+ });
1522
+
1523
+ Api.registerPlural('columns().responsiveHidden()', 'column().responsiveHidden()', function () {
1524
+ return this.iterator(
1525
+ 'column',
1526
+ function (settings, column) {
1527
+ return settings._responsive
1528
+ ? settings._responsive._responsiveOnlyHidden()[column]
1529
+ : false;
1530
+ },
1531
+ 1
1532
+ );
1533
+ });
1358
1534
 
1359
1535
  /**
1360
1536
  * Version information
@@ -1362,32 +1538,32 @@ Api.registerPlural( 'columns().responsiveHidden()', 'column().responsiveHidden()
1362
1538
  * @name Responsive.version
1363
1539
  * @static
1364
1540
  */
1365
- Responsive.version = '2.2.2';
1366
-
1541
+ Responsive.version = '2.5.0';
1367
1542
 
1368
1543
  $.fn.dataTable.Responsive = Responsive;
1369
1544
  $.fn.DataTable.Responsive = Responsive;
1370
1545
 
1371
1546
  // Attach a listener to the document which listens for DataTables initialisation
1372
1547
  // events so we can automatically initialise
1373
- $(document).on( 'preInit.dt.dtr', function (e, settings, json) {
1374
- if ( e.namespace !== 'dt' ) {
1548
+ $(document).on('preInit.dt.dtr', function (e, settings, json) {
1549
+ if (e.namespace !== 'dt') {
1375
1550
  return;
1376
1551
  }
1377
1552
 
1378
- if ( $(settings.nTable).hasClass( 'responsive' ) ||
1379
- $(settings.nTable).hasClass( 'dt-responsive' ) ||
1380
- settings.oInit.responsive ||
1381
- DataTable.defaults.responsive
1553
+ if (
1554
+ $(settings.nTable).hasClass('responsive') ||
1555
+ $(settings.nTable).hasClass('dt-responsive') ||
1556
+ settings.oInit.responsive ||
1557
+ DataTable.defaults.responsive
1382
1558
  ) {
1383
1559
  var init = settings.oInit.responsive;
1384
1560
 
1385
- if ( init !== false ) {
1386
- new Responsive( settings, $.isPlainObject( init ) ? init : {} );
1561
+ if (init !== false) {
1562
+ new Responsive(settings, $.isPlainObject(init) ? init : {});
1387
1563
  }
1388
1564
  }
1389
- } );
1565
+ });
1390
1566
 
1391
1567
 
1392
- return Responsive;
1568
+ return DataTable;
1393
1569
  }));