datatables.net 2.3.2 → 2.3.4

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.
package/js/dataTables.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! DataTables 2.3.2
1
+ /*! DataTables 2.3.4
2
2
  * © SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
@@ -166,6 +166,9 @@
166
166
  this.id = sId;
167
167
  }
168
168
 
169
+ // Replacing an existing colgroup with our own. Not ideal, but a merge could take a lot of code
170
+ $this.children('colgroup').remove();
171
+
169
172
  /* Create the settings object for this table and set some of the default parameters */
170
173
  var oSettings = $.extend( true, {}, DataTable.models.oSettings, {
171
174
  "sDestroyWidth": $this[0].style.width,
@@ -731,7 +734,7 @@
731
734
  *
732
735
  * The extension options for ordering of data available here is complimentary
733
736
  * to the default type based ordering that DataTables typically uses. It
734
- * allows much greater control over the the data that is being used to
737
+ * allows much greater control over the data that is being used to
735
738
  * order a column, but is necessarily therefore more complex.
736
739
  *
737
740
  * This type of ordering is useful if you want to do ordering based on data
@@ -890,7 +893,7 @@
890
893
  * `{type}-asc` and `{type}-desc` together. It is generally recommended
891
894
  * that only `{type}-pre` is used, as this provides the optimal
892
895
  * implementation in terms of speed, although the others are provided
893
- * for compatibility with existing Javascript sort functions.
896
+ * for compatibility with existing JavaScript sort functions.
894
897
  *
895
898
  * `{type}-pre`: Functions defined take a single parameter:
896
899
  *
@@ -900,7 +903,7 @@
900
903
  *
901
904
  * * `{*}` Data to be sorted upon
902
905
  *
903
- * `{type}-asc` and `{type}-desc`: Functions are typical Javascript sort
906
+ * `{type}-asc` and `{type}-desc`: Functions are typical JavaScript sort
904
907
  * functions, taking two parameters:
905
908
  *
906
909
  * 1. `{*}` Data to compare to the second parameter
@@ -1124,7 +1127,7 @@
1124
1127
  };
1125
1128
 
1126
1129
  // Convert from a formatted number with characters other than `.` as the
1127
- // decimal place, to a Javascript number
1130
+ // decimal place, to a JavaScript number
1128
1131
  var _numToDecimal = function ( num, decimalPoint ) {
1129
1132
  // Cache created regular expressions for speed as this function is called often
1130
1133
  if ( ! _re_dic[ decimalPoint ] ) {
@@ -1190,19 +1193,19 @@
1190
1193
 
1191
1194
  var _pluck = function ( a, prop, prop2 ) {
1192
1195
  var out = [];
1193
- var i=0, ien=a.length;
1196
+ var i=0, iLen=a.length;
1194
1197
 
1195
1198
  // Could have the test in the loop for slightly smaller code, but speed
1196
1199
  // is essential here
1197
1200
  if ( prop2 !== undefined ) {
1198
- for ( ; i<ien ; i++ ) {
1201
+ for ( ; i<iLen ; i++ ) {
1199
1202
  if ( a[i] && a[i][ prop ] ) {
1200
1203
  out.push( a[i][ prop ][ prop2 ] );
1201
1204
  }
1202
1205
  }
1203
1206
  }
1204
1207
  else {
1205
- for ( ; i<ien ; i++ ) {
1208
+ for ( ; i<iLen ; i++ ) {
1206
1209
  if ( a[i] ) {
1207
1210
  out.push( a[i][ prop ] );
1208
1211
  }
@@ -1218,19 +1221,19 @@
1218
1221
  var _pluck_order = function ( a, order, prop, prop2 )
1219
1222
  {
1220
1223
  var out = [];
1221
- var i=0, ien=order.length;
1224
+ var i=0, iLen=order.length;
1222
1225
 
1223
1226
  // Could have the test in the loop for slightly smaller code, but speed
1224
1227
  // is essential here
1225
1228
  if ( prop2 !== undefined ) {
1226
- for ( ; i<ien ; i++ ) {
1229
+ for ( ; i<iLen ; i++ ) {
1227
1230
  if ( a[ order[i] ] && a[ order[i] ][ prop ] ) {
1228
1231
  out.push( a[ order[i] ][ prop ][ prop2 ] );
1229
1232
  }
1230
1233
  }
1231
1234
  }
1232
1235
  else {
1233
- for ( ; i<ien ; i++ ) {
1236
+ for ( ; i<iLen ; i++ ) {
1234
1237
  if ( a[ order[i] ] ) {
1235
1238
  out.push( a[ order[i] ][ prop ] );
1236
1239
  }
@@ -1267,7 +1270,7 @@
1267
1270
  {
1268
1271
  var out = [];
1269
1272
 
1270
- for ( var i=0, ien=a.length ; i<ien ; i++ ) {
1273
+ for ( var i=0, iLen=a.length ; i<iLen ; i++ ) {
1271
1274
  if ( a[i] ) { // careful - will remove all falsy values!
1272
1275
  out.push( a[i] );
1273
1276
  }
@@ -1353,7 +1356,7 @@
1353
1356
  var sorted = src.slice().sort();
1354
1357
  var last = sorted[0];
1355
1358
 
1356
- for ( var i=1, ien=sorted.length ; i<ien ; i++ ) {
1359
+ for ( var i=1, iLen=sorted.length ; i<iLen ; i++ ) {
1357
1360
  if ( sorted[i] === last ) {
1358
1361
  return false;
1359
1362
  }
@@ -1389,10 +1392,10 @@
1389
1392
  var
1390
1393
  out = [],
1391
1394
  val,
1392
- i, ien=src.length,
1395
+ i, iLen=src.length,
1393
1396
  j, k=0;
1394
1397
 
1395
- again: for ( i=0 ; i<ien ; i++ ) {
1398
+ again: for ( i=0 ; i<iLen ; i++ ) {
1396
1399
  val = src[i];
1397
1400
 
1398
1401
  for ( j=0 ; j<k ; j++ ) {
@@ -1926,7 +1929,7 @@
1926
1929
  var searchCols = init.aoSearchCols;
1927
1930
 
1928
1931
  if ( searchCols ) {
1929
- for ( var i=0, ien=searchCols.length ; i<ien ; i++ ) {
1932
+ for ( var i=0, iLen=searchCols.length ; i<iLen ; i++ ) {
1930
1933
  if ( searchCols[i] ) {
1931
1934
  _fnCamelToHungarian( DataTable.models.oSearch, searchCols[i] );
1932
1935
  }
@@ -2079,7 +2082,7 @@
2079
2082
  oCol._sManualType = oOptions.sType;
2080
2083
  }
2081
2084
 
2082
- // `class` is a reserved word in Javascript, so we need to provide
2085
+ // `class` is a reserved word in JavaScript, so we need to provide
2083
2086
  // the ability to use a valid name for the camel case input
2084
2087
  if ( oOptions.className && ! oOptions.sClass )
2085
2088
  {
@@ -2236,14 +2239,14 @@
2236
2239
  * @returns {int} i the number of visible columns
2237
2240
  * @memberof DataTable#oApi
2238
2241
  */
2239
- function _fnVisbleColumns( settings )
2242
+ function _fnVisibleColumns( settings )
2240
2243
  {
2241
2244
  var layout = settings.aoHeader;
2242
2245
  var columns = settings.aoColumns;
2243
2246
  var vis = 0;
2244
2247
 
2245
2248
  if ( layout.length ) {
2246
- for ( var i=0, ien=layout[0].length ; i<ien ; i++ ) {
2249
+ for ( var i=0, iLen=layout[0].length ; i<iLen ; i++ ) {
2247
2250
  if ( columns[i].bVisible && $(layout[0][i].cell).css('display') !== 'none' ) {
2248
2251
  vis++;
2249
2252
  }
@@ -2278,7 +2281,7 @@
2278
2281
  /**
2279
2282
  * Allow the result from a type detection function to be `true` while
2280
2283
  * translating that into a string. Old type detection functions will
2281
- * return the type name if it passes. An obect store would be better,
2284
+ * return the type name if it passes. An object store would be better,
2282
2285
  * but not backwards compatible.
2283
2286
  *
2284
2287
  * @param {*} typeDetect Object or function for type detection
@@ -2301,11 +2304,11 @@
2301
2304
  var columns = settings.aoColumns;
2302
2305
  var data = settings.aoData;
2303
2306
  var types = DataTable.ext.type.detect;
2304
- var i, ien, j, jen, k, ken;
2307
+ var i, iLen, j, jen, k, ken;
2305
2308
  var col, detectedType, cache;
2306
2309
 
2307
2310
  // For each column, spin over the data type detection functions, seeing if one matches
2308
- for ( i=0, ien=columns.length ; i<ien ; i++ ) {
2311
+ for ( i=0, iLen=columns.length ; i<iLen ; i++ ) {
2309
2312
  col = columns[i];
2310
2313
  cache = [];
2311
2314
 
@@ -2575,7 +2578,7 @@
2575
2578
  var unit;
2576
2579
  var columns = settings.aoColumns;
2577
2580
 
2578
- for ( var i=0, ien=targets.length ; i<ien ; i++ ) {
2581
+ for ( var i=0, iLen=targets.length ; i<iLen ; i++ ) {
2579
2582
  var column = columns[ targets[i] ];
2580
2583
  var definedWidth = original ?
2581
2584
  column.sWidthOrig :
@@ -2621,7 +2624,7 @@
2621
2624
  }
2622
2625
  /**
2623
2626
  * Add a data array to the table, creating DOM node etc. This is the parallel to
2624
- * _fnGatherData, but for adding rows from a Javascript source, rather than a
2627
+ * _fnGatherData, but for adding rows from a JavaScript source, rather than a
2625
2628
  * DOM source.
2626
2629
  * @param {object} settings dataTables settings object
2627
2630
  * @param {array} data data array to be added
@@ -2761,10 +2764,10 @@
2761
2764
  }
2762
2765
 
2763
2766
  if ( type === 'filter' ) {
2764
- var fomatters = DataTable.ext.type.search;
2767
+ var formatters = DataTable.ext.type.search;
2765
2768
 
2766
- if ( fomatters[ col.sType ] ) {
2767
- cellData = fomatters[ col.sType ]( cellData );
2769
+ if ( formatters[ col.sType ] ) {
2770
+ cellData = formatters[ col.sType ]( cellData );
2768
2771
  }
2769
2772
  }
2770
2773
 
@@ -2894,7 +2897,7 @@
2894
2897
  function _fnInvalidate( settings, rowIdx, src, colIdx )
2895
2898
  {
2896
2899
  var row = settings.aoData[ rowIdx ];
2897
- var i, ien;
2900
+ var i, iLen;
2898
2901
 
2899
2902
  // Remove the cached data for the row
2900
2903
  row._aSortData = null;
@@ -2919,7 +2922,7 @@
2919
2922
  _fnWriteCell(cells[colIdx], display[colIdx]);
2920
2923
  }
2921
2924
  else {
2922
- for ( i=0, ien=cells.length ; i<ien ; i++ ) {
2925
+ for ( i=0, iLen=cells.length ; i<iLen ; i++ ) {
2923
2926
  _fnWriteCell(cells[i], display[i]);
2924
2927
  }
2925
2928
  }
@@ -2937,7 +2940,7 @@
2937
2940
  cols[ colIdx ].maxLenString = null;
2938
2941
  }
2939
2942
  else {
2940
- for ( i=0, ien=cols.length ; i<ien ; i++ ) {
2943
+ for ( i=0, iLen=cols.length ; i<iLen ; i++ ) {
2941
2944
  cols[i].sType = null;
2942
2945
  cols[i].maxLenString = null;
2943
2946
  }
@@ -3236,7 +3239,7 @@
3236
3239
  {
3237
3240
  var classes = settings.oClasses;
3238
3241
  var columns = settings.aoColumns;
3239
- var i, ien, row;
3242
+ var i, iLen, row;
3240
3243
  var target = side === 'header'
3241
3244
  ? settings.nTHead
3242
3245
  : settings.nTFoot;
@@ -3264,7 +3267,7 @@
3264
3267
  cellCount += this.colSpan;
3265
3268
  });
3266
3269
 
3267
- for ( i=cellCount, ien=columns.length ; i<ien ; i++ ) {
3270
+ for ( i=cellCount, iLen=columns.length ; i<iLen ; i++ ) {
3268
3271
  $('<th/>')
3269
3272
  .html( columns[i][titleProp] || '' )
3270
3273
  .appendTo( row );
@@ -3608,7 +3611,7 @@
3608
3611
 
3609
3612
  return $( '<tr/>' )
3610
3613
  .append( $('<td />', {
3611
- 'colSpan': _fnVisbleColumns( settings ),
3614
+ 'colSpan': _fnVisibleColumns( settings ),
3612
3615
  'class': settings.oClasses.empty.row
3613
3616
  } ).html( zero ) )[0];
3614
3617
  }
@@ -3792,7 +3795,7 @@
3792
3795
 
3793
3796
  var line = row[ item ].contents;
3794
3797
 
3795
- for ( var i=0, ien=line.length ; i<ien ; i++ ) {
3798
+ for ( var i=0, iLen=line.length ; i<iLen ; i++ ) {
3796
3799
  if ( ! line[i] ) {
3797
3800
  continue;
3798
3801
  }
@@ -3956,7 +3959,7 @@
3956
3959
  /**
3957
3960
  * Use the DOM source to create up an array of header cells. The idea here is to
3958
3961
  * create a layout grid (array) of rows x columns, which contains a reference
3959
- * to the cell that that point in the grid (regardless of col/rowspan), such that
3962
+ * to the cell at that point in the grid (regardless of col/rowspan), such that
3960
3963
  * any column / row could be removed and the new grid constructed
3961
3964
  * @param {node} thead The header/footer element for the table
3962
3965
  * @returns {array} Calculated layout array
@@ -4158,24 +4161,21 @@
4158
4161
  * DataTables - may be augmented by developer callbacks
4159
4162
  * @param {function} fn Callback function to run when data is obtained
4160
4163
  */
4161
- function _fnBuildAjax( oSettings, data, fn )
4162
- {
4164
+ function _fnBuildAjax(oSettings, data, fn) {
4163
4165
  var ajaxData;
4164
4166
  var ajax = oSettings.ajax;
4165
4167
  var instance = oSettings.oInstance;
4166
- var callback = function ( json ) {
4167
- var status = oSettings.jqXHR
4168
- ? oSettings.jqXHR.status
4169
- : null;
4168
+ var callback = function (json) {
4169
+ var status = oSettings.jqXHR ? oSettings.jqXHR.status : null;
4170
4170
 
4171
- if ( json === null || (typeof status === 'number' && status == 204 ) ) {
4171
+ if (json === null || (typeof status === 'number' && status == 204)) {
4172
4172
  json = {};
4173
- _fnAjaxDataSrc( oSettings, json, [] );
4173
+ _fnAjaxDataSrc(oSettings, json, []);
4174
4174
  }
4175
4175
 
4176
4176
  var error = json.error || json.sError;
4177
- if ( error ) {
4178
- _fnLog( oSettings, 0, error );
4177
+ if (error) {
4178
+ _fnLog(oSettings, 0, error);
4179
4179
  }
4180
4180
 
4181
4181
  // Microsoft often wrap JSON as a string in another JSON object
@@ -4183,30 +4183,27 @@
4183
4183
  if (json.d && typeof json.d === 'string') {
4184
4184
  try {
4185
4185
  json = JSON.parse(json.d);
4186
- }
4187
- catch (e) {
4186
+ } catch (e) {
4188
4187
  // noop
4189
4188
  }
4190
4189
  }
4191
4190
 
4192
4191
  oSettings.json = json;
4193
4192
 
4194
- _fnCallbackFire( oSettings, null, 'xhr', [oSettings, json, oSettings.jqXHR], true );
4195
- fn( json );
4193
+ _fnCallbackFire(oSettings, null, 'xhr', [oSettings, json, oSettings.jqXHR], true);
4194
+ fn(json);
4196
4195
  };
4197
4196
 
4198
- if ( $.isPlainObject( ajax ) && ajax.data )
4199
- {
4197
+ if ($.isPlainObject(ajax) && ajax.data) {
4200
4198
  ajaxData = ajax.data;
4201
4199
 
4202
- var newData = typeof ajaxData === 'function' ?
4203
- ajaxData( data, oSettings ) : // fn can manipulate data or return
4204
- ajaxData; // an object object or array to merge
4200
+ var newData =
4201
+ typeof ajaxData === 'function'
4202
+ ? ajaxData(data, oSettings) // fn can manipulate data or return
4203
+ : ajaxData; // an object or array to merge
4205
4204
 
4206
4205
  // If the function returned something, use that alone
4207
- data = typeof ajaxData === 'function' && newData ?
4208
- newData :
4209
- $.extend( true, data, newData );
4206
+ data = typeof ajaxData === 'function' && newData ? newData : $.extend(true, data, newData);
4210
4207
 
4211
4208
  // Remove the data property as we've resolved it already and don't want
4212
4209
  // jQuery to do it again (it is restored at the end of the function)
@@ -4214,50 +4211,53 @@
4214
4211
  }
4215
4212
 
4216
4213
  var baseAjax = {
4217
- "url": typeof ajax === 'string' ?
4218
- ajax :
4219
- '',
4220
- "data": data,
4221
- "success": callback,
4222
- "dataType": "json",
4223
- "cache": false,
4224
- "type": oSettings.sServerMethod,
4225
- "error": function (xhr, error) {
4226
- var ret = _fnCallbackFire( oSettings, null, 'xhr', [oSettings, null, oSettings.jqXHR], true );
4227
-
4228
- if ( ret.indexOf(true) === -1 ) {
4229
- if ( error == "parsererror" ) {
4230
- _fnLog( oSettings, 0, 'Invalid JSON response', 1 );
4214
+ url: typeof ajax === 'string' ? ajax : '',
4215
+ data: data,
4216
+ success: callback,
4217
+ dataType: 'json',
4218
+ cache: false,
4219
+ type: oSettings.sServerMethod,
4220
+ error: function (xhr, error) {
4221
+ var ret = _fnCallbackFire(
4222
+ oSettings,
4223
+ null,
4224
+ 'xhr',
4225
+ [oSettings, null, oSettings.jqXHR],
4226
+ true
4227
+ );
4228
+
4229
+ if (ret.indexOf(true) === -1) {
4230
+ if (error == 'parsererror') {
4231
+ _fnLog(oSettings, 0, 'Invalid JSON response', 1);
4231
4232
  }
4232
- else if ( xhr.readyState === 4 ) {
4233
- _fnLog( oSettings, 0, 'Ajax error', 7 );
4233
+ else if (xhr.readyState === 4) {
4234
+ _fnLog(oSettings, 0, 'Ajax error', 7);
4234
4235
  }
4235
4236
  }
4236
4237
 
4237
- _fnProcessingDisplay( oSettings, false );
4238
+ _fnProcessingDisplay(oSettings, false);
4238
4239
  }
4239
4240
  };
4240
4241
 
4241
4242
  // If `ajax` option is an object, extend and override our default base
4242
- if ( $.isPlainObject( ajax ) ) {
4243
- $.extend( baseAjax, ajax )
4243
+ if ($.isPlainObject(ajax)) {
4244
+ $.extend(baseAjax, ajax);
4244
4245
  }
4245
4246
 
4246
4247
  // Store the data submitted for the API
4247
4248
  oSettings.oAjaxData = data;
4248
4249
 
4249
4250
  // Allow plug-ins and external processes to modify the data
4250
- _fnCallbackFire( oSettings, null, 'preXhr', [oSettings, data, baseAjax], true );
4251
+ _fnCallbackFire(oSettings, null, 'preXhr', [oSettings, data, baseAjax], true);
4251
4252
 
4252
4253
  // Custom Ajax option to submit the parameters as a JSON string
4253
4254
  if (baseAjax.submitAs === 'json' && typeof data === 'object') {
4254
4255
  baseAjax.data = JSON.stringify(data);
4255
4256
  }
4256
4257
 
4257
- if ( typeof ajax === 'function' )
4258
- {
4258
+ if (typeof ajax === 'function') {
4259
4259
  // Is a function - let the caller define what needs to be done
4260
- oSettings.jqXHR = ajax.call( instance, data, callback, oSettings );
4260
+ oSettings.jqXHR = ajax.call(instance, data, callback, oSettings);
4261
4261
  }
4262
4262
  else if (ajax.url === '') {
4263
4263
  // No url, so don't load any data. Just apply an empty data array
@@ -4269,37 +4269,30 @@
4269
4269
  }
4270
4270
  else {
4271
4271
  // Object to extend the base settings
4272
- oSettings.jqXHR = $.ajax( baseAjax );
4272
+ oSettings.jqXHR = $.ajax(baseAjax);
4273
4273
  }
4274
4274
 
4275
4275
  // Restore for next time around
4276
- if ( ajaxData ) {
4276
+ if (ajaxData) {
4277
4277
  ajax.data = ajaxData;
4278
4278
  }
4279
4279
  }
4280
4280
 
4281
-
4282
4281
  /**
4283
4282
  * Update the table using an Ajax call
4284
4283
  * @param {object} settings dataTables settings object
4285
4284
  * @returns {boolean} Block the table drawing or not
4286
4285
  * @memberof DataTable#oApi
4287
4286
  */
4288
- function _fnAjaxUpdate( settings )
4289
- {
4287
+ function _fnAjaxUpdate(settings) {
4290
4288
  settings.iDraw++;
4291
- _fnProcessingDisplay( settings, true );
4289
+ _fnProcessingDisplay(settings, true);
4292
4290
 
4293
- _fnBuildAjax(
4294
- settings,
4295
- _fnAjaxParameters( settings ),
4296
- function(json) {
4297
- _fnAjaxUpdateDraw( settings, json );
4298
- }
4299
- );
4291
+ _fnBuildAjax(settings, _fnAjaxParameters(settings), function (json) {
4292
+ _fnAjaxUpdateDraw(settings, json);
4293
+ });
4300
4294
  }
4301
4295
 
4302
-
4303
4296
  /**
4304
4297
  * Build up the parameters in an object needed for a server-side processing
4305
4298
  * request.
@@ -4307,22 +4300,18 @@
4307
4300
  * @returns {bool} block the table drawing or not
4308
4301
  * @memberof DataTable#oApi
4309
4302
  */
4310
- function _fnAjaxParameters( settings )
4311
- {
4312
- var
4313
- columns = settings.aoColumns,
4303
+ function _fnAjaxParameters(settings) {
4304
+ var columns = settings.aoColumns,
4314
4305
  features = settings.oFeatures,
4315
4306
  preSearch = settings.oPreviousSearch,
4316
4307
  preColSearch = settings.aoPreSearchCols,
4317
- colData = function ( idx, prop ) {
4318
- return typeof columns[idx][prop] === 'function' ?
4319
- 'function' :
4320
- columns[idx][prop];
4308
+ colData = function (idx, prop) {
4309
+ return typeof columns[idx][prop] === 'function' ? 'function' : columns[idx][prop];
4321
4310
  };
4322
4311
 
4323
4312
  return {
4324
4313
  draw: settings.iDraw,
4325
- columns: columns.map( function ( column, i ) {
4314
+ columns: columns.map(function (column, i) {
4326
4315
  return {
4327
4316
  data: colData(i, 'mData'),
4328
4317
  name: column.sName,
@@ -4331,40 +4320,43 @@
4331
4320
  search: {
4332
4321
  value: preColSearch[i].search,
4333
4322
  regex: preColSearch[i].regex,
4334
- fixed: Object.keys(column.searchFixed).map( function(name) {
4335
- return {
4336
- name: name,
4337
- term: column.searchFixed[name].toString()
4338
- }
4339
- })
4323
+ fixed: Object.keys(column.searchFixed)
4324
+ .map(function (name) {
4325
+ return {
4326
+ name: name,
4327
+ term: typeof column.searchFixed[name] !== 'function'
4328
+ ? column.searchFixed[name].toString()
4329
+ : 'function'
4330
+ };
4331
+ })
4340
4332
  }
4341
4333
  };
4342
- } ),
4343
- order: _fnSortFlatten( settings ).map( function ( val ) {
4334
+ }),
4335
+ order: _fnSortFlatten(settings).map(function (val) {
4344
4336
  return {
4345
4337
  column: val.col,
4346
4338
  dir: val.dir,
4347
4339
  name: colData(val.col, 'sName')
4348
4340
  };
4349
- } ),
4341
+ }),
4350
4342
  start: settings._iDisplayStart,
4351
- length: features.bPaginate ?
4352
- settings._iDisplayLength :
4353
- -1,
4343
+ length: features.bPaginate ? settings._iDisplayLength : -1,
4354
4344
  search: {
4355
4345
  value: preSearch.search,
4356
4346
  regex: preSearch.regex,
4357
- fixed: Object.keys(settings.searchFixed).map( function(name) {
4358
- return {
4359
- name: name,
4360
- term: settings.searchFixed[name].toString()
4361
- }
4362
- })
4347
+ fixed: Object.keys(settings.searchFixed)
4348
+ .map(function (name) {
4349
+ return {
4350
+ name: name,
4351
+ term: typeof settings.searchFixed[name] !== 'function'
4352
+ ? settings.searchFixed[name].toString()
4353
+ : 'function'
4354
+ };
4355
+ })
4363
4356
  }
4364
4357
  };
4365
4358
  }
4366
4359
 
4367
-
4368
4360
  /**
4369
4361
  * Data the data from the server (nuking the old) and redraw the table
4370
4362
  * @param {object} oSettings dataTables settings object
@@ -4376,42 +4368,40 @@
4376
4368
  * @param {string} [json.sColumns] Column ordering (sName, comma separated)
4377
4369
  * @memberof DataTable#oApi
4378
4370
  */
4379
- function _fnAjaxUpdateDraw ( settings, json )
4380
- {
4371
+ function _fnAjaxUpdateDraw(settings, json) {
4381
4372
  var data = _fnAjaxDataSrc(settings, json);
4382
4373
  var draw = _fnAjaxDataSrcParam(settings, 'draw', json);
4383
4374
  var recordsTotal = _fnAjaxDataSrcParam(settings, 'recordsTotal', json);
4384
4375
  var recordsFiltered = _fnAjaxDataSrcParam(settings, 'recordsFiltered', json);
4385
4376
 
4386
- if ( draw !== undefined ) {
4377
+ if (draw !== undefined) {
4387
4378
  // Protect against out of sequence returns
4388
- if ( draw*1 < settings.iDraw ) {
4379
+ if (draw * 1 < settings.iDraw) {
4389
4380
  return;
4390
4381
  }
4391
4382
  settings.iDraw = draw * 1;
4392
4383
  }
4393
4384
 
4394
4385
  // No data in returned object, so rather than an array, we show an empty table
4395
- if ( ! data ) {
4386
+ if (!data) {
4396
4387
  data = [];
4397
4388
  }
4398
4389
 
4399
- _fnClearTable( settings );
4400
- settings._iRecordsTotal = parseInt(recordsTotal, 10);
4390
+ _fnClearTable(settings);
4391
+ settings._iRecordsTotal = parseInt(recordsTotal, 10);
4401
4392
  settings._iRecordsDisplay = parseInt(recordsFiltered, 10);
4402
4393
 
4403
- for ( var i=0, ien=data.length ; i<ien ; i++ ) {
4404
- _fnAddData( settings, data[i] );
4394
+ for (var i = 0, iLen = data.length; i < iLen; i++) {
4395
+ _fnAddData(settings, data[i]);
4405
4396
  }
4406
4397
  settings.aiDisplay = settings.aiDisplayMaster.slice();
4407
4398
 
4408
4399
  _fnColumnTypes(settings);
4409
- _fnDraw( settings, true );
4410
- _fnInitComplete( settings );
4411
- _fnProcessingDisplay( settings, false );
4400
+ _fnDraw(settings, true);
4401
+ _fnInitComplete(settings);
4402
+ _fnProcessingDisplay(settings, false);
4412
4403
  }
4413
4404
 
4414
-
4415
4405
  /**
4416
4406
  * Get the data from the JSON data source to use for drawing a table. Using
4417
4407
  * `_fnGetObjectDataFn` allows the data to be sourced from a property of the
@@ -4420,11 +4410,10 @@
4420
4410
  * @param {object} json Data source object / array from the server
4421
4411
  * @return {array} Array of data to use
4422
4412
  */
4423
- function _fnAjaxDataSrc ( settings, json, write )
4424
- {
4413
+ function _fnAjaxDataSrc(settings, json, write) {
4425
4414
  var dataProp = 'data';
4426
4415
 
4427
- if ($.isPlainObject( settings.ajax ) && settings.ajax.dataSrc !== undefined) {
4416
+ if ($.isPlainObject(settings.ajax) && settings.ajax.dataSrc !== undefined) {
4428
4417
  // Could in inside a `dataSrc` object, or not!
4429
4418
  var dataSrc = settings.ajax.dataSrc;
4430
4419
 
@@ -4437,20 +4426,18 @@
4437
4426
  }
4438
4427
  }
4439
4428
 
4440
- if ( ! write ) {
4441
- if ( dataProp === 'data' ) {
4429
+ if (!write) {
4430
+ if (dataProp === 'data') {
4442
4431
  // If the default, then we still want to support the old style, and safely ignore
4443
4432
  // it if possible
4444
4433
  return json.aaData || json[dataProp];
4445
4434
  }
4446
4435
 
4447
- return dataProp !== "" ?
4448
- _fnGetObjectDataFn( dataProp )( json ) :
4449
- json;
4436
+ return dataProp !== '' ? _fnGetObjectDataFn(dataProp)(json) : json;
4450
4437
  }
4451
-
4438
+
4452
4439
  // set
4453
- _fnSetObjectDataFn( dataProp )( json, write );
4440
+ _fnSetObjectDataFn(dataProp)(json, write);
4454
4441
  }
4455
4442
 
4456
4443
  /**
@@ -4460,14 +4447,12 @@
4460
4447
  * @param {*} json JSON data
4461
4448
  * @returns Resolved value
4462
4449
  */
4463
- function _fnAjaxDataSrcParam (settings, param, json) {
4464
- var dataSrc = $.isPlainObject( settings.ajax )
4465
- ? settings.ajax.dataSrc
4466
- : null;
4450
+ function _fnAjaxDataSrcParam(settings, param, json) {
4451
+ var dataSrc = $.isPlainObject(settings.ajax) ? settings.ajax.dataSrc : null;
4467
4452
 
4468
4453
  if (dataSrc && dataSrc[param]) {
4469
4454
  // Get from custom location
4470
- return _fnGetObjectDataFn( dataSrc[param] )( json );
4455
+ return _fnGetObjectDataFn(dataSrc[param])(json);
4471
4456
  }
4472
4457
 
4473
4458
  // else - Default behaviour
@@ -4484,9 +4469,7 @@
4484
4469
  old = 'iTotalDisplayRecords';
4485
4470
  }
4486
4471
 
4487
- return json[old] !== undefined
4488
- ? json[old]
4489
- : json[param];
4472
+ return json[old] !== undefined ? json[old] : json[param];
4490
4473
  }
4491
4474
 
4492
4475
 
@@ -4559,7 +4542,7 @@
4559
4542
  var displayRows = settings.aiDisplay;
4560
4543
  var row, rowIdx;
4561
4544
 
4562
- for ( var i=0, ien=filters.length ; i<ien ; i++ ) {
4545
+ for ( var i=0, iLen=filters.length ; i<iLen ; i++ ) {
4563
4546
  var rows = [];
4564
4547
 
4565
4548
  // Loop over each row and see if it should be included
@@ -4627,7 +4610,7 @@
4627
4610
  * @param {string} sSearch string to search for
4628
4611
  * @param {bool} bRegex treat as a regular expression or not
4629
4612
  * @param {bool} bSmart perform smart filtering or not
4630
- * @param {bool} bCaseInsensitive Do case insensitive matching or not
4613
+ * @param {bool} bCaseInsensitive Do case-insensitive matching or not
4631
4614
  * @returns {RegExp} constructed object
4632
4615
  * @memberof DataTable#oApi
4633
4616
  */
@@ -5370,7 +5353,7 @@
5370
5353
  }
5371
5354
 
5372
5355
  // 4. Clean up
5373
- // Figure out if there are scrollbar present - if so then we need a the header and footer to
5356
+ // Figure out if there are scrollbar present - if so then we need the header and footer to
5374
5357
  // provide a bit more space to allow "overflow" scrolling (i.e. past the scrollbar)
5375
5358
  var isScrolling = Math.floor(table.height()) > divBodyEl.clientHeight || divBody.css('overflow-y') == "scroll";
5376
5359
  var paddingSide = 'padding' + (browser.bScrollbarLeft ? 'Left' : 'Right' );
@@ -5468,7 +5451,7 @@
5468
5451
  .removeAttr( 'id' );
5469
5452
 
5470
5453
  // Clean up the table body
5471
- tmpTable.append('<tbody>')
5454
+ tmpTable.append('<tbody/>')
5472
5455
  var tr = $('<tr/>').appendTo( tmpTable.find('tbody') );
5473
5456
 
5474
5457
  // Clone the table header and footer - we can't use the header / footer
@@ -5677,7 +5660,7 @@
5677
5660
  if (! column.maxLenString) {
5678
5661
  var s, max='', maxLen = -1;
5679
5662
 
5680
- for ( var i=0, ien=settings.aiDisplayMaster.length ; i<ien ; i++ ) {
5663
+ for ( var i=0, iLen=settings.aiDisplayMaster.length ; i<iLen ; i++ ) {
5681
5664
  var rowIdx = settings.aiDisplayMaster[i];
5682
5665
  var data = _fnGetRowDisplay(settings, rowIdx)[colIdx];
5683
5666
 
@@ -5799,7 +5782,7 @@
5799
5782
  : [column];
5800
5783
 
5801
5784
  if ( columns.length ) {
5802
- for ( var i=0, ien=columns.length ; i<ien ; i++ ) {
5785
+ for ( var i=0, iLen=columns.length ; i<iLen ; i++ ) {
5803
5786
  var ret = _fnSortAdd( settings, columns[i], i, e.shiftKey );
5804
5787
 
5805
5788
  if (ret !== false) {
@@ -5848,7 +5831,7 @@
5848
5831
  masterMap[master[i]] = i;
5849
5832
  }
5850
5833
 
5851
- // And then cache what would be the indexOf fom the display
5834
+ // And then cache what would be the indexOf from the display
5852
5835
  for (i=0 ; i<display.length ; i++) {
5853
5836
  map[display[i]] = masterMap[display[i]];
5854
5837
  }
@@ -5974,7 +5957,7 @@
5974
5957
  function _fnSort ( oSettings, col, dir )
5975
5958
  {
5976
5959
  var
5977
- i, ien, iLen,
5960
+ i, iLen,
5978
5961
  aiOrig = [],
5979
5962
  extSort = DataTable.ext.type.order,
5980
5963
  aoData = oSettings.aoData,
@@ -6005,7 +5988,7 @@
6005
5988
  aSort = _fnSortFlatten( oSettings );
6006
5989
  }
6007
5990
 
6008
- for ( i=0, ien=aSort.length ; i<ien ; i++ ) {
5991
+ for ( i=0, iLen=aSort.length ; i<iLen ; i++ ) {
6009
5992
  sortCol = aSort[i];
6010
5993
 
6011
5994
  // Load the data needed for the sort, for each cell
@@ -6028,7 +6011,7 @@
6028
6011
 
6029
6012
  /* Do the sort - here we want multi-column sorting based on a given data source (column)
6030
6013
  * and sorting function (from oSort) in a certain direction. It's reasonably complex to
6031
- * follow on it's own, but this is what we want (example two column sorting):
6014
+ * follow on its own, but this is what we want (example two column sorting):
6032
6015
  * fnLocalSorting = function(a,b){
6033
6016
  * var test;
6034
6017
  * test = oSort['string-asc']('data11', 'data12');
@@ -6152,7 +6135,7 @@
6152
6135
  nextSortIdx = 0; // can't remove sorting completely
6153
6136
  }
6154
6137
 
6155
- if ( nextSortIdx === null ) {
6138
+ if ( nextSortIdx === null || asSorting[ nextSortIdx ] === '' ) {
6156
6139
  sorting.splice( sortIdx, 1 );
6157
6140
  }
6158
6141
  else {
@@ -6202,11 +6185,11 @@
6202
6185
  var sortClass = settings.oClasses.order.position;
6203
6186
  var sort = _fnSortFlatten( settings );
6204
6187
  var features = settings.oFeatures;
6205
- var i, ien, colIdx;
6188
+ var i, iLen, colIdx;
6206
6189
 
6207
6190
  if ( features.bSort && features.bSortClasses ) {
6208
6191
  // Remove old sorting classes
6209
- for ( i=0, ien=oldSort.length ; i<ien ; i++ ) {
6192
+ for ( i=0, iLen=oldSort.length ; i<iLen ; i++ ) {
6210
6193
  colIdx = oldSort[i].src;
6211
6194
 
6212
6195
  // Remove column sorting
@@ -6215,7 +6198,7 @@
6215
6198
  }
6216
6199
 
6217
6200
  // Add new column sorting
6218
- for ( i=0, ien=sort.length ; i<ien ; i++ ) {
6201
+ for ( i=0, iLen=sort.length ; i<iLen ; i++ ) {
6219
6202
  colIdx = sort[i].src;
6220
6203
 
6221
6204
  $( _pluck( settings.aoData, 'anCells', colIdx ) )
@@ -6349,7 +6332,7 @@
6349
6332
  }
6350
6333
 
6351
6334
  function _fnImplementState ( settings, s, callback) {
6352
- var i, ien;
6335
+ var i, iLen;
6353
6336
  var columns = settings.aoColumns;
6354
6337
  var currentNames = _pluck(settings.aoColumns, 'sName');
6355
6338
 
@@ -6478,7 +6461,7 @@
6478
6461
 
6479
6462
  // If the number of columns to restore is different from current, then all bets are off.
6480
6463
  if (set.length === columns.length) {
6481
- for ( i=0, ien=set.length ; i<ien ; i++ ) {
6464
+ for ( i=0, iLen=set.length ; i<iLen ; i++ ) {
6482
6465
  var col = set[i];
6483
6466
 
6484
6467
  // Visibility
@@ -6501,7 +6484,9 @@
6501
6484
 
6502
6485
  // If the api is defined then we need to adjust the columns once the visibility has been changed
6503
6486
  if (api) {
6504
- api.columns.adjust();
6487
+ api.one('draw', function () {
6488
+ api.columns.adjust();
6489
+ });
6505
6490
  }
6506
6491
  }
6507
6492
  }
@@ -6632,7 +6617,7 @@
6632
6617
 
6633
6618
 
6634
6619
  /**
6635
- * Bind an event handers to allow a click or return key to activate the callback.
6620
+ * Bind an event handler to allow a click or return key to activate the callback.
6636
6621
  * This is good for accessibility since a return on the keyboard will have the
6637
6622
  * same effect as a click, if the element has focus.
6638
6623
  * @param {element} n Element to bind the action to
@@ -6821,7 +6806,7 @@
6821
6806
  }
6822
6807
 
6823
6808
  /**
6824
- * Add elements to an array as quickly as possible, but stack stafe.
6809
+ * Add elements to an array as quickly as possible, but stack safe.
6825
6810
  *
6826
6811
  * @param {*} arr Array to add the data to
6827
6812
  * @param {*} data Data array that is to be added
@@ -7097,7 +7082,7 @@
7097
7082
 
7098
7083
  each: function ( fn )
7099
7084
  {
7100
- for ( var i=0, ien=this.length ; i<ien; i++ ) {
7085
+ for ( var i=0, iLen=this.length ; i<iLen; i++ ) {
7101
7086
  fn.call( this, this[i], i, this );
7102
7087
  }
7103
7088
 
@@ -7143,7 +7128,7 @@
7143
7128
  iterator: function ( flatten, type, fn, alwaysNew ) {
7144
7129
  var
7145
7130
  a = [], ret,
7146
- i, ien, j, jen,
7131
+ i, iLen, j, jen,
7147
7132
  context = this.context,
7148
7133
  rows, items, item,
7149
7134
  selector = this.selector;
@@ -7156,7 +7141,7 @@
7156
7141
  flatten = false;
7157
7142
  }
7158
7143
 
7159
- for ( i=0, ien=context.length ; i<ien ; i++ ) {
7144
+ for ( i=0, iLen=context.length ; i<iLen ; i++ ) {
7160
7145
  var apiInst = new _Api( context[i] );
7161
7146
 
7162
7147
  if ( type === 'table' ) {
@@ -7278,18 +7263,18 @@
7278
7263
  } );
7279
7264
 
7280
7265
 
7281
- function _api_scope( scope, fn, struc ) {
7266
+ function _api_scope( scope, fn, struct ) {
7282
7267
  return function () {
7283
7268
  var ret = fn.apply( scope || this, arguments );
7284
7269
 
7285
7270
  // Method extension
7286
- _Api.extend( ret, ret, struc.methodExt );
7271
+ _Api.extend( ret, ret, struct.methodExt );
7287
7272
  return ret;
7288
7273
  };
7289
7274
  }
7290
7275
 
7291
7276
  function _api_find( src, name ) {
7292
- for ( var i=0, ien=src.length ; i<ien ; i++ ) {
7277
+ for ( var i=0, iLen=src.length ; i<iLen ; i++ ) {
7293
7278
  if ( src[i].name === name ) {
7294
7279
  return src[i];
7295
7280
  }
@@ -7307,10 +7292,10 @@
7307
7292
  }
7308
7293
 
7309
7294
  var
7310
- i, ien,
7295
+ i, iLen,
7311
7296
  struct;
7312
7297
 
7313
- for ( i=0, ien=ext.length ; i<ien ; i++ ) {
7298
+ for ( i=0, iLen=ext.length ; i<iLen ; i++ ) {
7314
7299
  struct = ext[i];
7315
7300
 
7316
7301
  if (struct.name === '__proto__') {
@@ -7365,12 +7350,12 @@
7365
7350
  }
7366
7351
 
7367
7352
  var
7368
- i, ien,
7353
+ i, iLen,
7369
7354
  heir = name.split('.'),
7370
7355
  struct = __apiStruct,
7371
7356
  key, method;
7372
7357
 
7373
- for ( i=0, ien=heir.length ; i<ien ; i++ ) {
7358
+ for ( i=0, iLen=heir.length ; i<iLen ; i++ ) {
7374
7359
  method = heir[i].indexOf('()') !== -1;
7375
7360
  key = method ?
7376
7361
  heir[i].replace('()', '') :
@@ -7388,7 +7373,7 @@
7388
7373
  struct.push( src );
7389
7374
  }
7390
7375
 
7391
- if ( i === ien-1 ) {
7376
+ if ( i === iLen-1 ) {
7392
7377
  src.val = val;
7393
7378
  src.type = typeof val === 'function' ?
7394
7379
  'function' :
@@ -7730,7 +7715,7 @@
7730
7715
  */
7731
7716
  _api_register( 'page.len()', function ( len ) {
7732
7717
  // Note that we can't call this function 'length()' because `length`
7733
- // is a Javascript property of functions which defines how many arguments
7718
+ // is a JavaScript property of functions which defines how many arguments
7734
7719
  // the function expects.
7735
7720
  if ( len === undefined ) {
7736
7721
  return this.context.length !== 0 ?
@@ -7773,7 +7758,7 @@
7773
7758
  _fnClearTable( settings );
7774
7759
 
7775
7760
  var data = _fnAjaxDataSrc( settings, json );
7776
- for ( var i=0, ien=data.length ; i<ien ; i++ ) {
7761
+ for ( var i=0, iLen=data.length ; i<iLen ; i++ ) {
7777
7762
  _fnAddData( settings, data[i] );
7778
7763
  }
7779
7764
 
@@ -7896,7 +7881,7 @@
7896
7881
  {
7897
7882
  var
7898
7883
  out = [], res,
7899
- i, ien,
7884
+ i, iLen,
7900
7885
  selectorType = typeof selector;
7901
7886
 
7902
7887
  // Can't just check for isArray here, as an API or jQuery instance might be
@@ -7905,7 +7890,7 @@
7905
7890
  selector = [ selector ];
7906
7891
  }
7907
7892
 
7908
- for ( i=0, ien=selector.length ; i<ien ; i++ ) {
7893
+ for ( i=0, iLen=selector.length ; i<iLen ; i++ ) {
7909
7894
  res = selectFn( typeof selector[i] === 'string' ? selector[i].trim() : selector[i] );
7910
7895
 
7911
7896
  // Remove empty items
@@ -7921,7 +7906,7 @@
7921
7906
  // selector extensions
7922
7907
  var ext = _ext.selector[ type ];
7923
7908
  if ( ext.length ) {
7924
- for ( i=0, ien=ext.length ; i<ien ; i++ ) {
7909
+ for ( i=0, iLen=ext.length ; i<iLen ; i++ ) {
7925
7910
  out = ext[i]( settings, opts, out );
7926
7911
  }
7927
7912
  }
@@ -7976,7 +7961,7 @@
7976
7961
  var _selector_row_indexes = function ( settings, opts )
7977
7962
  {
7978
7963
  var
7979
- i, ien, tmp, a=[],
7964
+ i, iLen, tmp, a=[],
7980
7965
  displayFiltered = settings.aiDisplay,
7981
7966
  displayMaster = settings.aiDisplayMaster;
7982
7967
 
@@ -7999,7 +7984,7 @@
7999
7984
  // Current page implies that order=current and filter=applied, since it is
8000
7985
  // fairly senseless otherwise, regardless of what order and search actually
8001
7986
  // are
8002
- for ( i=settings._iDisplayStart, ien=settings.fnDisplayEnd() ; i<ien ; i++ ) {
7987
+ for ( i=settings._iDisplayStart, iLen=settings.fnDisplayEnd() ; i<iLen ; i++ ) {
8003
7988
  a.push( displayFiltered[i] );
8004
7989
  }
8005
7990
  }
@@ -8014,7 +7999,7 @@
8014
7999
  // O(n+m) solution by creating a hash map
8015
8000
  var displayFilteredMap = {};
8016
8001
 
8017
- for ( i=0, ien=displayFiltered.length ; i<ien ; i++ ) {
8002
+ for ( i=0, iLen=displayFiltered.length ; i<iLen ; i++ ) {
8018
8003
  displayFilteredMap[displayFiltered[i]] = null;
8019
8004
  }
8020
8005
 
@@ -8026,7 +8011,7 @@
8026
8011
  }
8027
8012
  }
8028
8013
  else if ( order == 'index' || order == 'original' ) {
8029
- for ( i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
8014
+ for ( i=0, iLen=settings.aoData.length ; i<iLen ; i++ ) {
8030
8015
  if (! settings.aoData[i]) {
8031
8016
  continue;
8032
8017
  }
@@ -8243,7 +8228,7 @@
8243
8228
  var context = this.context;
8244
8229
 
8245
8230
  // `iterator` will drop undefined values, but in this case we want them
8246
- for ( var i=0, ien=context.length ; i<ien ; i++ ) {
8231
+ for ( var i=0, iLen=context.length ; i<iLen ; i++ ) {
8247
8232
  for ( var j=0, jen=this[i].length ; j<jen ; j++ ) {
8248
8233
  var id = context[i].rowIdFn( context[i].aoData[ this[i][j] ]._aData );
8249
8234
  a.push( (hash === true ? '#' : '' )+ id );
@@ -8287,10 +8272,10 @@
8287
8272
 
8288
8273
  _api_register( 'rows.add()', function ( rows ) {
8289
8274
  var newRows = this.iterator( 'table', function ( settings ) {
8290
- var row, i, ien;
8275
+ var row, i, iLen;
8291
8276
  var out = [];
8292
8277
 
8293
- for ( i=0, ien=rows.length ; i<ien ; i++ ) {
8278
+ for ( i=0, iLen=rows.length ; i<iLen ; i++ ) {
8294
8279
  row = rows[i];
8295
8280
 
8296
8281
  if ( row.nodeName && row.nodeName.toUpperCase() === 'TR' ) {
@@ -8437,7 +8422,7 @@
8437
8422
  var addRow = function ( r, k ) {
8438
8423
  // Recursion to allow for arrays of jQuery objects
8439
8424
  if ( Array.isArray( r ) || r instanceof $ ) {
8440
- for ( var i=0, ien=r.length ; i<ien ; i++ ) {
8425
+ for ( var i=0, iLen=r.length ; i<iLen ; i++ ) {
8441
8426
  addRow( r[i], k );
8442
8427
  }
8443
8428
  return;
@@ -8457,7 +8442,7 @@
8457
8442
 
8458
8443
  $('td', created)
8459
8444
  .addClass( k )
8460
- .html( r )[0].colSpan = _fnVisbleColumns( ctx );
8445
+ .html( r )[0].colSpan = _fnVisibleColumns( ctx );
8461
8446
 
8462
8447
  rows.push( created[0] );
8463
8448
  }
@@ -8495,7 +8480,7 @@
8495
8480
  var row = ctx[0].aoData[ idx !== undefined ? idx : api[0] ];
8496
8481
 
8497
8482
  if ( row && row._details ) {
8498
- row._details.remove();
8483
+ row._details.detach();
8499
8484
 
8500
8485
  row._detailsShow = undefined;
8501
8486
  row._details = undefined;
@@ -8569,9 +8554,9 @@
8569
8554
 
8570
8555
  // Update the colspan for the details rows (note, only if it already has
8571
8556
  // a colspan)
8572
- var row, visible = _fnVisbleColumns( ctx );
8557
+ var row, visible = _fnVisibleColumns( ctx );
8573
8558
 
8574
- for ( var i=0, ien=data.length ; i<ien ; i++ ) {
8559
+ for ( var i=0, iLen=data.length ; i<iLen ; i++ ) {
8575
8560
  row = data[i];
8576
8561
 
8577
8562
  if ( row && row._details ) {
@@ -8592,7 +8577,7 @@
8592
8577
  return;
8593
8578
  }
8594
8579
 
8595
- for ( var i=0, ien=data.length ; i<ien ; i++ ) {
8580
+ for ( var i=0, iLen=data.length ; i<iLen ; i++ ) {
8596
8581
  if ( data[i] && data[i]._details ) {
8597
8582
  __details_remove( api, i );
8598
8583
  }
@@ -8696,7 +8681,7 @@
8696
8681
  // iterator callback in columns().data()
8697
8682
  var __columnData = function ( settings, column, r1, r2, rows, type ) {
8698
8683
  var a = [];
8699
- for ( var row=0, ien=rows.length ; row<ien ; row++ ) {
8684
+ for ( var row=0, iLen=rows.length ; row<iLen ; row++ ) {
8700
8685
  a.push( _fnGetCellData( settings, rows[row], column, type ) );
8701
8686
  }
8702
8687
  return a;
@@ -8896,7 +8881,7 @@
8896
8881
  cols = settings.aoColumns,
8897
8882
  col = cols[ column ],
8898
8883
  data = settings.aoData,
8899
- cells, i, ien, tr;
8884
+ cells, i, iLen, tr;
8900
8885
 
8901
8886
  // Get
8902
8887
  if ( vis === undefined ) {
@@ -8914,7 +8899,7 @@
8914
8899
  // Need to decide if we should use appendChild or insertBefore
8915
8900
  var insertBefore = _pluck(cols, 'bVisible').indexOf(true, column+1);
8916
8901
 
8917
- for ( i=0, ien=data.length ; i<ien ; i++ ) {
8902
+ for ( i=0, iLen=data.length ; i<iLen ; i++ ) {
8918
8903
  if (data[i]) {
8919
8904
  tr = data[i].nTr;
8920
8905
  cells = data[i].anCells;
@@ -9080,7 +9065,7 @@
9080
9065
  // Update colspan for no records display. Child rows and extensions will use their own
9081
9066
  // listeners to do this - only need to update the empty table item here
9082
9067
  if ( ! settings.aiDisplay.length ) {
9083
- $(settings.nTBody).find('td[colspan]').attr('colspan', _fnVisbleColumns(settings));
9068
+ $(settings.nTBody).find('td[colspan]').attr('colspan', _fnVisibleColumns(settings));
9084
9069
  }
9085
9070
 
9086
9071
  _fnSaveState( settings );
@@ -9166,7 +9151,7 @@
9166
9151
  var allCells = $(_flatten( [], cells ));
9167
9152
  var row;
9168
9153
  var columns = settings.aoColumns.length;
9169
- var a, i, ien, j, o, host;
9154
+ var a, i, iLen, j, o, host;
9170
9155
 
9171
9156
  var run = function ( s ) {
9172
9157
  var fnSelector = typeof s === 'function';
@@ -9175,7 +9160,7 @@
9175
9160
  // All cells and function selectors
9176
9161
  a = [];
9177
9162
 
9178
- for ( i=0, ien=rows.length ; i<ien ; i++ ) {
9163
+ for ( i=0, iLen=rows.length ; i<iLen ; i++ ) {
9179
9164
  row = rows[i];
9180
9165
 
9181
9166
  for ( j=0 ; j<columns ; j++ ) {
@@ -9280,12 +9265,12 @@
9280
9265
  // Row + column selector
9281
9266
  var columns = this.columns( columnSelector, internalOpts );
9282
9267
  var rows = this.rows( rowSelector, internalOpts );
9283
- var i, ien, j, jen;
9268
+ var i, iLen, j, jen;
9284
9269
 
9285
9270
  var cellsNoOpts = this.iterator( 'table', function ( settings, idx ) {
9286
9271
  var a = [];
9287
9272
 
9288
- for ( i=0, ien=rows[idx].length ; i<ien ; i++ ) {
9273
+ for ( i=0, iLen=rows[idx].length ; i<iLen ; i++ ) {
9289
9274
  for ( j=0, jen=columns[idx].length ; j<jen ; j++ ) {
9290
9275
  a.push( {
9291
9276
  row: rows[idx][i],
@@ -9497,7 +9482,7 @@
9497
9482
  return this.iterator( 'column', function ( settings, idx ) {
9498
9483
  var sort = _fnSortFlatten( settings );
9499
9484
 
9500
- for ( var i=0, ien=sort.length ; i<ien ; i++ ) {
9485
+ for ( var i=0, iLen=sort.length ; i<iLen ; i++ ) {
9501
9486
  if ( sort[i].col === idx ) {
9502
9487
  return sort[i].dir;
9503
9488
  }
@@ -10188,9 +10173,11 @@
10188
10173
  }
10189
10174
 
10190
10175
  if ( $.isPlainObject( resolved ) ) {
10191
- resolved = plural !== undefined && resolved[ plural ] !== undefined ?
10192
- resolved[ plural ] :
10193
- resolved._;
10176
+ resolved = plural !== undefined && resolved[ plural ] !== undefined
10177
+ ? resolved[ plural ]
10178
+ : plural === false
10179
+ ? resolved
10180
+ : resolved._;
10194
10181
  }
10195
10182
 
10196
10183
  return typeof resolved === 'string'
@@ -10219,7 +10206,7 @@
10219
10206
  * @type string
10220
10207
  * @default Version number
10221
10208
  */
10222
- DataTable.version = "2.3.2";
10209
+ DataTable.version = "2.3.4";
10223
10210
 
10224
10211
  /**
10225
10212
  * Private data store, containing all of the settings objects that are
@@ -10252,7 +10239,7 @@
10252
10239
  */
10253
10240
  DataTable.models.oSearch = {
10254
10241
  /**
10255
- * Flag to indicate if the filtering should be case insensitive or not
10242
+ * Flag to whether or not the filtering should be case-insensitive
10256
10243
  */
10257
10244
  "caseInsensitive": true,
10258
10245
 
@@ -10537,7 +10524,7 @@
10537
10524
  * from v1.10 onwards the primary interface is camel case. In order to avoid
10538
10525
  * breaking backwards compatibility utterly with this change, the Hungarian
10539
10526
  * version is still, internally the primary interface, but is is not documented
10540
- * - hence the @name tags in each doc comment. This allows a Javascript function
10527
+ * - hence the @name tags in each doc comment. This allows a JavaScript function
10541
10528
  * to create a map from Hungarian notation to camel case (going the other direction
10542
10529
  * would require each property to be listed, which would add around 3K to the size
10543
10530
  * of DataTables, while this method is about a 0.5K hit).
@@ -10556,7 +10543,7 @@
10556
10543
  /**
10557
10544
  * An array of data to use for the table, passed in at initialisation which
10558
10545
  * will be used in preference to any data which is already in the DOM. This is
10559
- * particularly useful for constructing tables purely in Javascript, for
10546
+ * particularly useful for constructing tables purely in JavaScript, for
10560
10547
  * example with a custom Ajax call.
10561
10548
  */
10562
10549
  "aaData": null,
@@ -10623,7 +10610,7 @@
10623
10610
  * * `dataSrc` - By default DataTables will look for the property `data` (or
10624
10611
  * `aaData` for compatibility with DataTables 1.9-) when obtaining data
10625
10612
  * from an Ajax source or for server-side processing - this parameter
10626
- * allows that property to be changed. You can use Javascript dotted
10613
+ * allows that property to be changed. You can use JavaScript dotted
10627
10614
  * object notation to get a data source for multiple levels of nesting, or
10628
10615
  * it my be used as a function. As a function it takes a single parameter,
10629
10616
  * the JSON returned from the server, which can be manipulated as
@@ -10747,13 +10734,13 @@
10747
10734
  "bFilter": true,
10748
10735
 
10749
10736
  /**
10750
- * Used only for compatiblity with DT1
10737
+ * Used only for compatibility with DT1
10751
10738
  * @deprecated
10752
10739
  */
10753
10740
  "bInfo": true,
10754
10741
 
10755
10742
  /**
10756
- * Used only for compatiblity with DT1
10743
+ * Used only for compatibility with DT1
10757
10744
  * @deprecated
10758
10745
  */
10759
10746
  "bLengthChange": true,
@@ -10844,7 +10831,7 @@
10844
10831
  * Enable or disable state saving. When enabled HTML5 `localStorage` will be
10845
10832
  * used to save table display information such as pagination information,
10846
10833
  * display length, filtering and sorting. As such when the end user reloads
10847
- * the page the display display will match what thy had previously set up.
10834
+ * the page the display will match what thy had previously set up.
10848
10835
  */
10849
10836
  "bStateSave": false,
10850
10837
 
@@ -11201,7 +11188,7 @@
11201
11188
  /**
11202
11189
  * When using Ajax sourced data and during the first draw when DataTables is
11203
11190
  * gathering the data, this message is shown in an empty row in the table to
11204
- * indicate to the end user the the data is being loaded. Note that this
11191
+ * indicate to the end user the data is being loaded. Note that this
11205
11192
  * parameter is not used when loading data by server-side processing, just
11206
11193
  * Ajax sourced data with client-side processing.
11207
11194
  */
@@ -11462,8 +11449,8 @@
11462
11449
  * * `string` - read an object property from the data source. There are
11463
11450
  * three 'special' options that can be used in the string to alter how
11464
11451
  * DataTables reads the data from the source object:
11465
- * * `.` - Dotted Javascript notation. Just as you use a `.` in
11466
- * Javascript to read from nested objects, so to can the options
11452
+ * * `.` - Dotted JavaScript notation. Just as you use a `.` in
11453
+ * JavaScript to read from nested objects, so to can the options
11467
11454
  * specified in `data`. For example: `browser.version` or
11468
11455
  * `browser.name`. If your object parameter name contains a period, use
11469
11456
  * `\\` to escape it - i.e. `first\\.name`.
@@ -11521,7 +11508,7 @@
11521
11508
  * This property is the rendering partner to `data` and it is suggested that
11522
11509
  * when you want to manipulate data for display (including filtering,
11523
11510
  * sorting etc) without altering the underlying data for the table, use this
11524
- * property. `render` can be considered to be the the read only companion to
11511
+ * property. `render` can be considered to be the read only companion to
11525
11512
  * `data` which is read / write (then as such more complex). Like `data`
11526
11513
  * this option can be given in a number of different ways to effect its
11527
11514
  * behaviour:
@@ -11531,8 +11518,8 @@
11531
11518
  * * `string` - read an object property from the data source. There are
11532
11519
  * three 'special' options that can be used in the string to alter how
11533
11520
  * DataTables reads the data from the source object:
11534
- * * `.` - Dotted Javascript notation. Just as you use a `.` in
11535
- * Javascript to read from nested objects, so to can the options
11521
+ * * `.` - Dotted JavaScript notation. Just as you use a `.` in
11522
+ * JavaScript to read from nested objects, so to can the options
11536
11523
  * specified in `data`. For example: `browser.version` or
11537
11524
  * `browser.name`. If your object parameter name contains a period, use
11538
11525
  * `\\` to escape it - i.e. `first\\.name`.
@@ -11635,7 +11622,7 @@
11635
11622
  * The type allows you to specify how the data for this column will be
11636
11623
  * ordered. Four types (string, numeric, date and html (which will strip
11637
11624
  * HTML tags before ordering)) are currently available. Note that only date
11638
- * formats understood by Javascript's Date() object will be accepted as type
11625
+ * formats understood by JavaScript's Date() object will be accepted as type
11639
11626
  * date. For example: "Mar 26, 2008 5:03 PM". May take the values: 'string',
11640
11627
  * 'numeric', 'date' or 'html' (by default). Further types can be adding
11641
11628
  * through plug-ins.
@@ -11687,7 +11674,7 @@
11687
11674
  /**
11688
11675
  * Delay the creation of TR and TD elements until they are actually
11689
11676
  * needed by a driven page draw. This can give a significant speed
11690
- * increase for Ajax source and Javascript source data, but makes no
11677
+ * increase for Ajax source and JavaScript source data, but makes no
11691
11678
  * difference at all for DOM and server-side processing tables.
11692
11679
  * Note that this parameter will be set by the initialisation routine. To
11693
11680
  * set a default use {@link DataTable.defaults}.
@@ -11704,13 +11691,13 @@
11704
11691
  "bFilter": null,
11705
11692
 
11706
11693
  /**
11707
- * Used only for compatiblity with DT1
11694
+ * Used only for compatibility with DT1
11708
11695
  * @deprecated
11709
11696
  */
11710
11697
  "bInfo": true,
11711
11698
 
11712
11699
  /**
11713
- * Used only for compatiblity with DT1
11700
+ * Used only for compatibility with DT1
11714
11701
  * @deprecated
11715
11702
  */
11716
11703
  "bLengthChange": true,
@@ -12581,7 +12568,7 @@
12581
12568
  },
12582
12569
  order: {
12583
12570
  pre: function (d) {
12584
- // The renderer gives us Moment, Luxon or Date obects for the sorting, all of which have a
12571
+ // The renderer gives us Moment, Luxon or Date objects for the sorting, all of which have a
12585
12572
  // `valueOf` which gives milliseconds epoch
12586
12573
  return d.valueOf();
12587
12574
  }
@@ -12636,7 +12623,10 @@
12636
12623
  }
12637
12624
 
12638
12625
  var formatted = to === null
12639
- ? __mld(dt, 'toDate', 'toJSDate', '')[localeString]()
12626
+ ? __mld(dt, 'toDate', 'toJSDate', '')[localeString](
12627
+ navigator.language,
12628
+ { timeZone: "UTC" }
12629
+ )
12640
12630
  : __mld(dt, 'format', 'toFormat', 'toISOString', to);
12641
12631
 
12642
12632
  // XSS protection
@@ -13147,7 +13137,7 @@
13147
13137
 
13148
13138
  // If a decimal place other than `.` is used, it needs to be given to the
13149
13139
  // function so we can detect it and replace with a `.` which is the only
13150
- // decimal place Javascript recognises - it is not locale aware.
13140
+ // decimal place JavaScript recognises - it is not locale aware.
13151
13141
  if ( decimalPlace ) {
13152
13142
  d = _numToDecimal( d, decimalPlace );
13153
13143
  }
@@ -13205,7 +13195,7 @@
13205
13195
  // on destroy, while the `dt` namespaced event is the one we are
13206
13196
  // listening for
13207
13197
  $(settings.nTable).on( 'order.dt.DT column-visibility.dt.DT', function ( e, ctx, column ) {
13208
- if ( settings !== ctx ) { // need to check this this is the host
13198
+ if ( settings !== ctx ) { // need to check if this is the host
13209
13199
  return; // table, not a nested one
13210
13200
  }
13211
13201