datatables.net 2.3.5 → 2.3.6
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 +50 -26
- package/js/dataTables.min.js +2 -2
- package/js/dataTables.min.mjs +2 -2
- package/js/dataTables.mjs +50 -26
- package/package.json +1 -1
- package/types/types.d.ts +5 -0
package/js/dataTables.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! DataTables 2.3.
|
|
1
|
+
/*! DataTables 2.3.6
|
|
2
2
|
* © SpryMedia Ltd - datatables.net/license
|
|
3
3
|
*/
|
|
4
4
|
|
|
@@ -139,7 +139,7 @@ var DataTable = function ( selector, options )
|
|
|
139
139
|
"sDestroyWidth": $this[0].style.width,
|
|
140
140
|
"sInstance": sId,
|
|
141
141
|
"sTableId": sId,
|
|
142
|
-
colgroup: $('<colgroup>')
|
|
142
|
+
colgroup: $('<colgroup>'),
|
|
143
143
|
fastData: function (row, column, type) {
|
|
144
144
|
return _fnGetCellData(oSettings, row, column, type);
|
|
145
145
|
}
|
|
@@ -212,6 +212,7 @@ var DataTable = function ( selector, options )
|
|
|
212
212
|
"orderHandler",
|
|
213
213
|
"titleRow",
|
|
214
214
|
"typeDetect",
|
|
215
|
+
"columnTitleTag",
|
|
215
216
|
[ "iCookieDuration", "iStateDuration" ], // backwards compat
|
|
216
217
|
[ "oSearch", "oPreviousSearch" ],
|
|
217
218
|
[ "aoSearchCols", "aoPreSearchCols" ],
|
|
@@ -376,7 +377,7 @@ var DataTable = function ( selector, options )
|
|
|
376
377
|
|
|
377
378
|
if ( oSettings.caption ) {
|
|
378
379
|
if ( caption.length === 0 ) {
|
|
379
|
-
caption = $('<caption/>').
|
|
380
|
+
caption = $('<caption/>').prependTo( $this );
|
|
380
381
|
}
|
|
381
382
|
|
|
382
383
|
caption.html( oSettings.caption );
|
|
@@ -389,6 +390,14 @@ var DataTable = function ( selector, options )
|
|
|
389
390
|
oSettings.captionNode = caption[0];
|
|
390
391
|
}
|
|
391
392
|
|
|
393
|
+
// Place the colgroup element in the correct location for the HTML structure
|
|
394
|
+
if (caption.length) {
|
|
395
|
+
oSettings.colgroup.insertAfter(caption);
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
oSettings.colgroup.prependTo(oSettings.nTable);
|
|
399
|
+
}
|
|
400
|
+
|
|
392
401
|
if ( thead.length === 0 ) {
|
|
393
402
|
thead = $('<thead/>').appendTo($this);
|
|
394
403
|
}
|
|
@@ -404,7 +413,7 @@ var DataTable = function ( selector, options )
|
|
|
404
413
|
if ( tfoot.length === 0 ) {
|
|
405
414
|
// If we are a scrolling table, and no footer has been given, then we need to create
|
|
406
415
|
// a tfoot element for the caption element to be appended to
|
|
407
|
-
tfoot = $('<tfoot/>').
|
|
416
|
+
tfoot = $('<tfoot/>').insertAfter(thead);
|
|
408
417
|
}
|
|
409
418
|
oSettings.nTFoot = tfoot[0];
|
|
410
419
|
|
|
@@ -1245,7 +1254,7 @@ var _removeEmpty = function ( a )
|
|
|
1245
1254
|
};
|
|
1246
1255
|
|
|
1247
1256
|
// Replaceable function in api.util
|
|
1248
|
-
var _stripHtml = function (input) {
|
|
1257
|
+
var _stripHtml = function (input, replacement) {
|
|
1249
1258
|
if (! input || typeof input !== 'string') {
|
|
1250
1259
|
return input;
|
|
1251
1260
|
}
|
|
@@ -1257,7 +1266,7 @@ var _stripHtml = function (input) {
|
|
|
1257
1266
|
|
|
1258
1267
|
var previous;
|
|
1259
1268
|
|
|
1260
|
-
input = input.replace(_re_html, ''); // Complete tags
|
|
1269
|
+
input = input.replace(_re_html, replacement || ''); // Complete tags
|
|
1261
1270
|
|
|
1262
1271
|
// Safety for incomplete script tag - use do / while to ensure that
|
|
1263
1272
|
// we get all instances
|
|
@@ -1722,7 +1731,7 @@ DataTable.util = {
|
|
|
1722
1731
|
}
|
|
1723
1732
|
},
|
|
1724
1733
|
|
|
1725
|
-
stripHtml: function (mixed) {
|
|
1734
|
+
stripHtml: function (mixed, replacement) {
|
|
1726
1735
|
var type = typeof mixed;
|
|
1727
1736
|
|
|
1728
1737
|
if (type === 'function') {
|
|
@@ -1730,7 +1739,7 @@ DataTable.util = {
|
|
|
1730
1739
|
return;
|
|
1731
1740
|
}
|
|
1732
1741
|
else if (type === 'string') {
|
|
1733
|
-
return _stripHtml(mixed);
|
|
1742
|
+
return _stripHtml(mixed, replacement);
|
|
1734
1743
|
}
|
|
1735
1744
|
return mixed;
|
|
1736
1745
|
},
|
|
@@ -3332,7 +3341,7 @@ function _fnHeaderLayout( settings, source, incColumns )
|
|
|
3332
3341
|
colspan++;
|
|
3333
3342
|
}
|
|
3334
3343
|
|
|
3335
|
-
var titleSpan = $('
|
|
3344
|
+
var titleSpan = $('.dt-column-title', cell);
|
|
3336
3345
|
|
|
3337
3346
|
structure[row][column] = {
|
|
3338
3347
|
cell: cell,
|
|
@@ -4046,8 +4055,8 @@ function _fnDetectHeader ( settings, thead, write )
|
|
|
4046
4055
|
}
|
|
4047
4056
|
|
|
4048
4057
|
// Wrap the column title so we can write to it in future
|
|
4049
|
-
if ( $('
|
|
4050
|
-
$(
|
|
4058
|
+
if ( $('.dt-column-title', cell).length === 0) {
|
|
4059
|
+
$(document.createElement(settings.columnTitleTag))
|
|
4051
4060
|
.addClass('dt-column-title')
|
|
4052
4061
|
.append(cell.childNodes)
|
|
4053
4062
|
.appendTo(cell);
|
|
@@ -4058,9 +4067,9 @@ function _fnDetectHeader ( settings, thead, write )
|
|
|
4058
4067
|
isHeader &&
|
|
4059
4068
|
jqCell.filter(':not([data-dt-order=disable])').length !== 0 &&
|
|
4060
4069
|
jqCell.parent(':not([data-dt-order=disable])').length !== 0 &&
|
|
4061
|
-
$('
|
|
4070
|
+
$('.dt-column-order', cell).length === 0
|
|
4062
4071
|
) {
|
|
4063
|
-
$(
|
|
4072
|
+
$(document.createElement(settings.columnTitleTag))
|
|
4064
4073
|
.addClass('dt-column-order')
|
|
4065
4074
|
.appendTo(cell);
|
|
4066
4075
|
}
|
|
@@ -4069,7 +4078,7 @@ function _fnDetectHeader ( settings, thead, write )
|
|
|
4069
4078
|
// layout for those elements
|
|
4070
4079
|
var headerFooter = isHeader ? 'header' : 'footer';
|
|
4071
4080
|
|
|
4072
|
-
if ( $('
|
|
4081
|
+
if ( $('div.dt-column-' + headerFooter, cell).length === 0) {
|
|
4073
4082
|
$('<div>')
|
|
4074
4083
|
.addClass('dt-column-' + headerFooter)
|
|
4075
4084
|
.append(cell.childNodes)
|
|
@@ -4226,6 +4235,10 @@ function _fnBuildAjax(oSettings, data, fn) {
|
|
|
4226
4235
|
// Custom Ajax option to submit the parameters as a JSON string
|
|
4227
4236
|
if (baseAjax.submitAs === 'json' && typeof data === 'object') {
|
|
4228
4237
|
baseAjax.data = JSON.stringify(data);
|
|
4238
|
+
|
|
4239
|
+
if (!baseAjax.contentType) {
|
|
4240
|
+
baseAjax.contentType = 'application/json; charset=utf-8';
|
|
4241
|
+
}
|
|
4229
4242
|
}
|
|
4230
4243
|
|
|
4231
4244
|
if (typeof ajax === 'function') {
|
|
@@ -5484,7 +5497,7 @@ function _fnCalculateColumnWidths ( settings )
|
|
|
5484
5497
|
var autoClass = _ext.type.className[column.sType];
|
|
5485
5498
|
var padding = column.sContentPadding || (scrollX ? '-' : '');
|
|
5486
5499
|
var text = longest + padding;
|
|
5487
|
-
var insert = longest.indexOf('<') === -1
|
|
5500
|
+
var insert = longest.indexOf('<') === -1 && longest.indexOf('&') === -1
|
|
5488
5501
|
? document.createTextNode(text)
|
|
5489
5502
|
: text
|
|
5490
5503
|
|
|
@@ -5672,15 +5685,20 @@ function _fnGetWideStrings( settings, colIdx )
|
|
|
5672
5685
|
.replace(/id=".*?"/g, '')
|
|
5673
5686
|
.replace(/name=".*?"/g, '');
|
|
5674
5687
|
|
|
5675
|
-
|
|
5688
|
+
// Don't want Javascript at all in these calculation cells.
|
|
5689
|
+
cellString = cellString.replace(/<script.*?<\/script>/gi, ' ');
|
|
5690
|
+
|
|
5691
|
+
var noHtml = _stripHtml(cellString, ' ')
|
|
5676
5692
|
.replace( / /g, ' ' );
|
|
5677
5693
|
|
|
5694
|
+
// The length is calculated on the text only, but we keep the HTML
|
|
5695
|
+
// in the string so it can be used in the calculation table
|
|
5678
5696
|
collection.push({
|
|
5679
|
-
str:
|
|
5680
|
-
len:
|
|
5697
|
+
str: cellString,
|
|
5698
|
+
len: noHtml.length
|
|
5681
5699
|
});
|
|
5682
5700
|
|
|
5683
|
-
allStrings.push(
|
|
5701
|
+
allStrings.push(noHtml);
|
|
5684
5702
|
}
|
|
5685
5703
|
|
|
5686
5704
|
// Order and then cut down to the size we need
|
|
@@ -8735,7 +8753,7 @@ var __column_header = function ( settings, column, row ) {
|
|
|
8735
8753
|
// Automatic - find the _last_ unique cell from the top that is not empty (last for
|
|
8736
8754
|
// backwards compatibility)
|
|
8737
8755
|
for (var i=0 ; i<header.length ; i++) {
|
|
8738
|
-
if (header[i][column].unique && $('
|
|
8756
|
+
if (header[i][column].unique && $('.dt-column-title', header[i][column].cell).text()) {
|
|
8739
8757
|
target = i;
|
|
8740
8758
|
}
|
|
8741
8759
|
}
|
|
@@ -9042,7 +9060,7 @@ _api_registerPlural( 'columns().titles()', 'column().title()', function (title,
|
|
|
9042
9060
|
title = undefined;
|
|
9043
9061
|
}
|
|
9044
9062
|
|
|
9045
|
-
var span = $('
|
|
9063
|
+
var span = $('.dt-column-title', this.column(column).header(row));
|
|
9046
9064
|
|
|
9047
9065
|
if (title !== undefined) {
|
|
9048
9066
|
span.html(title);
|
|
@@ -10216,8 +10234,8 @@ _api_register( 'i18n()', function ( token, def, plural ) {
|
|
|
10216
10234
|
|
|
10217
10235
|
// Needed for header and footer, so pulled into its own function
|
|
10218
10236
|
function cleanHeader(node, className) {
|
|
10219
|
-
$(node).find('
|
|
10220
|
-
$(node).find('
|
|
10237
|
+
$(node).find('.dt-column-order').remove();
|
|
10238
|
+
$(node).find('.dt-column-title').each(function () {
|
|
10221
10239
|
var title = $(this).html();
|
|
10222
10240
|
$(this).parent().parent().append(title);
|
|
10223
10241
|
$(this).remove();
|
|
@@ -10235,7 +10253,7 @@ function cleanHeader(node, className) {
|
|
|
10235
10253
|
* @type string
|
|
10236
10254
|
* @default Version number
|
|
10237
10255
|
*/
|
|
10238
|
-
DataTable.version = "2.3.
|
|
10256
|
+
DataTable.version = "2.3.6";
|
|
10239
10257
|
|
|
10240
10258
|
/**
|
|
10241
10259
|
* Private data store, containing all of the settings objects that are
|
|
@@ -11403,7 +11421,10 @@ DataTable.defaults = {
|
|
|
11403
11421
|
iDeferLoading: null,
|
|
11404
11422
|
|
|
11405
11423
|
/** Event listeners */
|
|
11406
|
-
on: null
|
|
11424
|
+
on: null,
|
|
11425
|
+
|
|
11426
|
+
/** Title wrapper element type */
|
|
11427
|
+
columnTitleTag: 'span'
|
|
11407
11428
|
};
|
|
11408
11429
|
|
|
11409
11430
|
_fnHungarianMap( DataTable.defaults );
|
|
@@ -12367,7 +12388,10 @@ DataTable.models.oSettings = {
|
|
|
12367
12388
|
orderHandler: true,
|
|
12368
12389
|
|
|
12369
12390
|
/** Title row indicator */
|
|
12370
|
-
titleRow: null
|
|
12391
|
+
titleRow: null,
|
|
12392
|
+
|
|
12393
|
+
/** Title wrapper element type */
|
|
12394
|
+
columnTitleTag: 'span'
|
|
12371
12395
|
};
|
|
12372
12396
|
|
|
12373
12397
|
/**
|
package/package.json
CHANGED
package/types/types.d.ts
CHANGED
|
@@ -338,6 +338,11 @@ export interface Config {
|
|
|
338
338
|
*/
|
|
339
339
|
columnDefs?: ConfigColumnDefs[];
|
|
340
340
|
|
|
341
|
+
/**
|
|
342
|
+
* HTML element to use for the title elements (including order indicator)
|
|
343
|
+
*/
|
|
344
|
+
columnTitleTag?: string;
|
|
345
|
+
|
|
341
346
|
/**
|
|
342
347
|
* Data to use as the display data for the table.
|
|
343
348
|
*/
|