jquery-tablesorter 1.15.0 → 1.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/jquery-tablesorter/version.rb +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +71 -30
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +109 -65
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +83 -62
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-range.js +93 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-input-select.js +6 -4
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-metric.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columnSelector.js +4 -2
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-formatter-html5.js +2 -2
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-formatter-jui.js +2 -3
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-formatter-select2.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-type-insideRange.js +42 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter.js +57 -45
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-formatter.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-grouping.js +9 -7
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-output.js +9 -1
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +68 -30
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-scroller.js +41 -41
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-stickyHeaders.js +25 -16
- metadata +4 -2
@@ -4,7 +4,7 @@
|
|
4
4
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀▀██
|
5
5
|
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
6
6
|
*/
|
7
|
-
/*! tablesorter (FORK) widgets - updated
|
7
|
+
/*! tablesorter (FORK) widgets - updated 03-05-2015 (v2.21.0)*/
|
8
8
|
/* Includes: storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort */
|
9
9
|
/*! Widget: storage */
|
10
10
|
;(function ($, window, document) {
|
@@ -347,7 +347,10 @@ ts.addWidget({
|
|
347
347
|
|
348
348
|
})(jQuery);
|
349
349
|
|
350
|
-
/*! Widget: filter
|
350
|
+
/*! Widget: filter - updated 3/5/2015 (v2.21.0) *//*
|
351
|
+
* Requires tablesorter v2.8+ and jQuery 1.7+
|
352
|
+
* by Rob Garrison
|
353
|
+
*/
|
351
354
|
;(function ($) {
|
352
355
|
'use strict';
|
353
356
|
var ts = $.tablesorter = $.tablesorter || {};
|
@@ -558,7 +561,7 @@ ts.filter = {
|
|
558
561
|
parsed = data.parsed[index],
|
559
562
|
query = ts.filter.parseFilter(c, data.iFilter.replace(ts.filter.regex.orReplace, "|"), index, parsed);
|
560
563
|
// look for an exact match with the "or" unless the "filter-match" class is found
|
561
|
-
if (!c.$
|
564
|
+
if (!c.$headerIndexed[index].hasClass('filter-match') && /\|/.test(query)) {
|
562
565
|
// show all results while using filter match. Fixes #727
|
563
566
|
if (query[ query.length - 1 ] === '|') { query += '*'; }
|
564
567
|
query = data.anyMatch && $.isArray(data.rowArray) ? '(' + query + ')' : '^(' + query + ')$';
|
@@ -679,7 +682,7 @@ ts.filter = {
|
|
679
682
|
fxn = ts.getColumnData( table, wo.filter_functions, column );
|
680
683
|
if (fxn) {
|
681
684
|
// remove "filter-select" from header otherwise the options added here are replaced with all options
|
682
|
-
$header = c.$
|
685
|
+
$header = c.$headerIndexed[column].removeClass('filter-select');
|
683
686
|
// don't build select if "filter-false" or "parser-false" set
|
684
687
|
noSelect = !($header.hasClass('filter-false') || $header.hasClass('parser-false'));
|
685
688
|
options = '';
|
@@ -775,7 +778,8 @@ ts.filter = {
|
|
775
778
|
}
|
776
779
|
},
|
777
780
|
filterInitComplete: function(c){
|
778
|
-
var
|
781
|
+
var indx, len,
|
782
|
+
wo = c.widgetOptions,
|
779
783
|
count = 0,
|
780
784
|
completed = function(){
|
781
785
|
wo.filter_initialized = true;
|
@@ -785,11 +789,12 @@ ts.filter = {
|
|
785
789
|
if ( $.isEmptyObject( wo.filter_formatter ) ) {
|
786
790
|
completed();
|
787
791
|
} else {
|
788
|
-
|
789
|
-
|
792
|
+
len = wo.filter_formatterInit.length;
|
793
|
+
for (indx = 0; indx < len; indx++) {
|
794
|
+
if (wo.filter_formatterInit[indx] === 1) {
|
790
795
|
count++;
|
791
796
|
}
|
792
|
-
}
|
797
|
+
}
|
793
798
|
clearTimeout(wo.filter_initTimer);
|
794
799
|
if (!wo.filter_initialized && count === wo.filter_formatterCount) {
|
795
800
|
// filter widget initialized
|
@@ -805,7 +810,7 @@ ts.filter = {
|
|
805
810
|
},
|
806
811
|
|
807
812
|
setDefaults: function(table, c, wo) {
|
808
|
-
var isArray, saved, indx,
|
813
|
+
var isArray, saved, indx, col, $filters,
|
809
814
|
// get current (default) filters
|
810
815
|
filters = ts.getFilters(table) || [];
|
811
816
|
if (wo.filter_saveFilters && ts.storage) {
|
@@ -816,8 +821,12 @@ ts.filter = {
|
|
816
821
|
}
|
817
822
|
// if no filters saved, then check default settings
|
818
823
|
if (filters.join('') === '') {
|
819
|
-
|
820
|
-
|
824
|
+
// allow adding default setting to external filters
|
825
|
+
$filters = c.$headers.add( wo.filter_$externalFilters ).filter('[' + wo.filter_defaultAttrib + ']');
|
826
|
+
for (indx = 0; indx <= c.columns; indx++) {
|
827
|
+
// include data-column="all" external filters
|
828
|
+
col = indx === c.columns ? 'all' : indx;
|
829
|
+
filters[indx] = $filters.filter('[data-column="' + col + '"]').attr(wo.filter_defaultAttrib) || filters[indx] || '';
|
821
830
|
}
|
822
831
|
}
|
823
832
|
c.$table.data('lastSearch', filters);
|
@@ -846,7 +855,7 @@ ts.filter = {
|
|
846
855
|
for (column = 0; column < columns; column++) {
|
847
856
|
disabled = false;
|
848
857
|
// assuming last cell of a column is the main column
|
849
|
-
$header = c.$
|
858
|
+
$header = c.$headerIndexed[column];
|
850
859
|
ffxn = ts.getColumnData( table, wo.filter_functions, column );
|
851
860
|
buildSelect = (wo.filter_functions && ffxn && typeof ffxn !== "function" ) ||
|
852
861
|
$header.hasClass('filter-select');
|
@@ -1071,7 +1080,7 @@ ts.filter = {
|
|
1071
1080
|
},
|
1072
1081
|
multipleColumns: function( c, $input ) {
|
1073
1082
|
// look for multiple columns "1-3,4-6,8" in data-column
|
1074
|
-
var ranges, singles, indx,
|
1083
|
+
var temp, ranges, range, start, end, singles, i, indx, len,
|
1075
1084
|
wo = c.widgetOptions,
|
1076
1085
|
// only target "all" column inputs on initialization
|
1077
1086
|
// & don't target "all" column inputs if they don't exist
|
@@ -1081,31 +1090,32 @@ ts.filter = {
|
|
1081
1090
|
// process column range
|
1082
1091
|
if ( targets && /-/.test( val ) ) {
|
1083
1092
|
ranges = val.match( /(\d+)\s*-\s*(\d+)/g );
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
if ( start > end ) {
|
1093
|
+
len = ranges.length;
|
1094
|
+
for (indx = 0; indx < len; indx++) {
|
1095
|
+
range = ranges[indx].split( /\s*-\s*/ );
|
1096
|
+
start = parseInt( range[0], 10 ) || 0;
|
1097
|
+
end = parseInt( range[1], 10 ) || ( c.columns - 1 );
|
1098
|
+
if ( start > end ) { temp = start; start = end; end = temp; } // swap
|
1090
1099
|
if ( end >= c.columns ) { end = c.columns - 1; }
|
1091
1100
|
for ( ; start <= end; start++ ) {
|
1092
1101
|
columns.push(start);
|
1093
1102
|
}
|
1094
1103
|
// remove processed range from val
|
1095
|
-
val = val.replace(
|
1096
|
-
}
|
1104
|
+
val = val.replace( ranges[indx], '' );
|
1105
|
+
}
|
1097
1106
|
}
|
1098
1107
|
// process single columns
|
1099
1108
|
if ( targets && /,/.test( val ) ) {
|
1100
1109
|
singles = val.split( /\s*,\s*/ );
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1110
|
+
len = singles.length;
|
1111
|
+
for (i = 0; i < len; i++) {
|
1112
|
+
if (singles[i] !== '') {
|
1113
|
+
indx = parseInt( singles[i], 10 );
|
1104
1114
|
if ( indx < c.columns ) {
|
1105
1115
|
columns.push( indx );
|
1106
1116
|
}
|
1107
1117
|
}
|
1108
|
-
}
|
1118
|
+
}
|
1109
1119
|
}
|
1110
1120
|
// return all columns
|
1111
1121
|
if (!columns.length) {
|
@@ -1133,12 +1143,12 @@ ts.filter = {
|
|
1133
1143
|
data.parsed = c.$headers.map(function(columnIndex) {
|
1134
1144
|
return c.parsers && c.parsers[columnIndex] && c.parsers[columnIndex].parsed ||
|
1135
1145
|
// getData won't return "parsed" if other "filter-" class names exist (e.g. <th class="filter-select filter-parsed">)
|
1136
|
-
ts.getData && ts.getData(c.$
|
1146
|
+
ts.getData && ts.getData(c.$headerIndexed[columnIndex], ts.getColumnData( table, c.headers, columnIndex ), 'filter') === 'parsed' ||
|
1137
1147
|
$(this).hasClass('filter-parsed');
|
1138
1148
|
}).get();
|
1139
1149
|
|
1140
1150
|
if (c.debug) {
|
1141
|
-
ts.log('Starting filter widget search', filters);
|
1151
|
+
ts.log('Filter: Starting filter widget search', filters);
|
1142
1152
|
time = new Date();
|
1143
1153
|
}
|
1144
1154
|
// filtered rows count
|
@@ -1157,7 +1167,7 @@ ts.filter = {
|
|
1157
1167
|
$rows = $( $.map(norm_rows, function(el){ return el[columnIndex].$row.get(); }) );
|
1158
1168
|
|
1159
1169
|
if (combinedFilters === '' || wo.filter_serversideFiltering) {
|
1160
|
-
$rows.removeClass(wo.filter_filteredRow).not('.' + c.cssChildRow).
|
1170
|
+
$rows.removeClass(wo.filter_filteredRow).not('.' + c.cssChildRow).css('display', '');
|
1161
1171
|
} else {
|
1162
1172
|
// filter out child rows
|
1163
1173
|
$rows = $rows.not('.' + c.cssChildRow);
|
@@ -1209,14 +1219,14 @@ ts.filter = {
|
|
1209
1219
|
// don't search only filtered if the value is negative ('> -10' => '> -100' will ignore hidden rows)
|
1210
1220
|
!(/(>=?\s*-\d)/.test(val) || /(<=?\s*\d)/.test(val)) &&
|
1211
1221
|
// if filtering using a select without a "filter-match" class (exact match) - fixes #593
|
1212
|
-
!( val !== '' && c.$filters && c.$filters.eq(indx).find('select').length && !c.$
|
1222
|
+
!( val !== '' && c.$filters && c.$filters.eq(indx).find('select').length && !c.$headerIndexed[indx].hasClass('filter-match') );
|
1213
1223
|
}
|
1214
1224
|
}
|
1215
1225
|
notFiltered = $rows.not('.' + wo.filter_filteredRow).length;
|
1216
1226
|
// can't search when all rows are hidden - this happens when looking for exact matches
|
1217
1227
|
if (searchFiltered && notFiltered === 0) { searchFiltered = false; }
|
1218
1228
|
if (c.debug) {
|
1219
|
-
ts.log(
|
1229
|
+
ts.log( 'Filter: Searching through ' + ( searchFiltered && notFiltered < len ? notFiltered : 'all' ) + ' rows' );
|
1220
1230
|
}
|
1221
1231
|
if (data.anyMatchFlag) {
|
1222
1232
|
if (c.sortLocaleCompare) {
|
@@ -1339,7 +1349,7 @@ ts.filter = {
|
|
1339
1349
|
// data.iFilter = case insensitive (if wo.filter_ignoreCase is true), data.filter = case sensitive
|
1340
1350
|
data.iFilter = wo.filter_ignoreCase ? (data.filter || '').toLocaleLowerCase() : data.filter;
|
1341
1351
|
fxn = ts.getColumnData( table, wo.filter_functions, columnIndex );
|
1342
|
-
$cell = c.$
|
1352
|
+
$cell = c.$headerIndexed[columnIndex];
|
1343
1353
|
hasSelect = $cell.hasClass('filter-select');
|
1344
1354
|
if ( fxn || ( hasSelect && val ) ) {
|
1345
1355
|
if (fxn === true || hasSelect) {
|
@@ -1347,10 +1357,10 @@ ts.filter = {
|
|
1347
1357
|
result = ($cell.hasClass('filter-match')) ? data.iExact.search(data.iFilter) >= 0 : data.filter === data.exact;
|
1348
1358
|
} else if (typeof fxn === 'function') {
|
1349
1359
|
// filter callback( exact cell content, parser normalized content, filter input value, column index, jQuery row object )
|
1350
|
-
result = fxn(data.exact, data.cache, data.filter, columnIndex, $rows.eq(rowIndex));
|
1360
|
+
result = fxn(data.exact, data.cache, data.filter, columnIndex, $rows.eq(rowIndex), c);
|
1351
1361
|
} else if (typeof fxn[ffxn || data.filter] === 'function') {
|
1352
1362
|
// selector option function
|
1353
|
-
result = fxn[ffxn || data.filter](data.exact, data.cache, data.filter, columnIndex, $rows.eq(rowIndex));
|
1363
|
+
result = fxn[ffxn || data.filter](data.exact, data.cache, data.filter, columnIndex, $rows.eq(rowIndex), c);
|
1354
1364
|
}
|
1355
1365
|
} else {
|
1356
1366
|
filterMatched = null;
|
@@ -1377,8 +1387,8 @@ ts.filter = {
|
|
1377
1387
|
}
|
1378
1388
|
}
|
1379
1389
|
$rows.eq(rowIndex)
|
1380
|
-
.
|
1381
|
-
.
|
1390
|
+
.toggleClass(wo.filter_filteredRow, !showRow)[0]
|
1391
|
+
.display = showRow ? '' : 'none';
|
1382
1392
|
if (childRow.length) {
|
1383
1393
|
childRow.toggleClass(wo.filter_filteredRow, !showRow);
|
1384
1394
|
}
|
@@ -1404,7 +1414,7 @@ ts.filter = {
|
|
1404
1414
|
},
|
1405
1415
|
getOptionSource: function(table, column, onlyAvail) {
|
1406
1416
|
table = $(table)[0];
|
1407
|
-
var cts,
|
1417
|
+
var cts, indx, len,
|
1408
1418
|
c = table.config,
|
1409
1419
|
wo = c.widgetOptions,
|
1410
1420
|
parsed = [],
|
@@ -1442,16 +1452,17 @@ ts.filter = {
|
|
1442
1452
|
return $.inArray(value, arry) === indx;
|
1443
1453
|
});
|
1444
1454
|
|
1445
|
-
if (c.$
|
1455
|
+
if (c.$headerIndexed[column].hasClass('filter-select-nosort')) {
|
1446
1456
|
// unsorted select options
|
1447
1457
|
return arry;
|
1448
1458
|
} else {
|
1459
|
+
len = arry.length;
|
1449
1460
|
// parse select option values
|
1450
|
-
|
1461
|
+
for (indx = 0; indx < len; indx++) {
|
1451
1462
|
// parse array data using set column parser; this DOES NOT pass the original
|
1452
1463
|
// table cell to the parser format function
|
1453
|
-
parsed.push({ t :
|
1454
|
-
}
|
1464
|
+
parsed.push({ t : arry[indx], p : c.parsers && c.parsers[column].format( arry[indx], table, [], column ) });
|
1465
|
+
}
|
1455
1466
|
|
1456
1467
|
// sort parsed select options
|
1457
1468
|
cts = c.textSorter || '';
|
@@ -1473,9 +1484,10 @@ ts.filter = {
|
|
1473
1484
|
});
|
1474
1485
|
// rebuild arry from sorted parsed data
|
1475
1486
|
arry = [];
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1487
|
+
len = parsed.length;
|
1488
|
+
for (indx = 0; indx < len; indx++) {
|
1489
|
+
arry.push( parsed[indx].t );
|
1490
|
+
}
|
1479
1491
|
return arry;
|
1480
1492
|
}
|
1481
1493
|
},
|
@@ -1495,7 +1507,7 @@ ts.filter = {
|
|
1495
1507
|
// check if has class filtered
|
1496
1508
|
if (onlyAvail && row.className.match(wo.filter_filteredRow)) { continue; }
|
1497
1509
|
// get non-normalized cell content
|
1498
|
-
if (wo.filter_useParsedData || c.parsers[column].parsed || c.$
|
1510
|
+
if (wo.filter_useParsedData || c.parsers[column].parsed || c.$headerIndexed[column].hasClass('filter-parsed')) {
|
1499
1511
|
arry.push( '' + cache.normalized[rowIndex][column] );
|
1500
1512
|
} else {
|
1501
1513
|
cell = row.cells[column];
|
@@ -1514,7 +1526,7 @@ ts.filter = {
|
|
1514
1526
|
var indx, val, txt, t, $filters, $filter,
|
1515
1527
|
c = table.config,
|
1516
1528
|
wo = c.widgetOptions,
|
1517
|
-
node = c.$
|
1529
|
+
node = c.$headerIndexed[column],
|
1518
1530
|
// t.data('placeholder') won't work in jQuery older than 1.4.3
|
1519
1531
|
options = '<option value="">' + ( node.data('placeholder') || node.attr('data-placeholder') || wo.filter_placeholder.select || '' ) + '</option>',
|
1520
1532
|
// Get curent filter value
|
@@ -1569,7 +1581,7 @@ ts.filter = {
|
|
1569
1581
|
columns = c.columns;
|
1570
1582
|
// build default select dropdown
|
1571
1583
|
for (columnIndex = 0; columnIndex < columns; columnIndex++) {
|
1572
|
-
$header = c.$
|
1584
|
+
$header = c.$headerIndexed[columnIndex];
|
1573
1585
|
noSelect = !($header.hasClass('filter-false') || $header.hasClass('parser-false'));
|
1574
1586
|
// look for the filter-select class; build/update it if found
|
1575
1587
|
if (($header.hasClass('filter-select') || ts.getColumnData( table, wo.filter_functions, columnIndex ) === true) && noSelect) {
|
@@ -1655,7 +1667,10 @@ ts.setFilters = function(table, filter, apply, skipFirst) {
|
|
1655
1667
|
|
1656
1668
|
})(jQuery);
|
1657
1669
|
|
1658
|
-
/*! Widget: stickyHeaders
|
1670
|
+
/*! Widget: stickyHeaders - updated 3/5/2015 (v2.21.0) *//*
|
1671
|
+
* Requires tablesorter v2.8+ and jQuery 1.4.3+
|
1672
|
+
* by Rob Garrison
|
1673
|
+
*/
|
1659
1674
|
;(function ($, window) {
|
1660
1675
|
'use strict';
|
1661
1676
|
var ts = $.tablesorter = $.tablesorter || {};
|
@@ -1663,6 +1678,7 @@ var ts = $.tablesorter = $.tablesorter || {};
|
|
1663
1678
|
$.extend(ts.css, {
|
1664
1679
|
sticky : 'tablesorter-stickyHeader', // stickyHeader
|
1665
1680
|
stickyVis : 'tablesorter-sticky-visible',
|
1681
|
+
stickyHide: 'tablesorter-sticky-hidden',
|
1666
1682
|
stickyWrap: 'tablesorter-sticky-wrapper'
|
1667
1683
|
});
|
1668
1684
|
|
@@ -1731,6 +1747,7 @@ ts.addWidget({
|
|
1731
1747
|
return;
|
1732
1748
|
}
|
1733
1749
|
var $table = c.$table,
|
1750
|
+
// add position: relative to attach element, hopefully it won't cause trouble.
|
1734
1751
|
$attach = $(wo.stickyHeaders_attachTo),
|
1735
1752
|
namespace = c.namespace + 'stickyheaders ',
|
1736
1753
|
// element to watch for the scroll event
|
@@ -1740,8 +1757,7 @@ ts.addWidget({
|
|
1740
1757
|
$header = $thead.children('tr').not('.sticky-false').children(),
|
1741
1758
|
$tfoot = $table.children('tfoot'),
|
1742
1759
|
$stickyOffset = isNaN(wo.stickyHeaders_offset) ? $(wo.stickyHeaders_offset) : '',
|
1743
|
-
stickyOffset = $
|
1744
|
-
$stickyOffset.height() || 0 : parseInt(wo.stickyHeaders_offset, 10) || 0,
|
1760
|
+
stickyOffset = $stickyOffset.length ? $stickyOffset.height() || 0 : parseInt(wo.stickyHeaders_offset, 10) || 0,
|
1745
1761
|
// is this table nested? If so, find parent sticky header wrapper (div, not table)
|
1746
1762
|
$nestedSticky = $table.parent().closest('.' + ts.css.table).hasClass('hasStickyHeaders') ?
|
1747
1763
|
$table.parent().closest('table.tablesorter')[0].config.widgetOptions.$sticky.parent() : [],
|
@@ -1750,14 +1766,16 @@ ts.addWidget({
|
|
1750
1766
|
$stickyTable = wo.$sticky = $table.clone()
|
1751
1767
|
.addClass('containsStickyHeaders ' + ts.css.sticky + ' ' + wo.stickyHeaders)
|
1752
1768
|
.wrap('<div class="' + ts.css.stickyWrap + '">'),
|
1753
|
-
$stickyWrap = $stickyTable.parent()
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1769
|
+
$stickyWrap = $stickyTable.parent()
|
1770
|
+
.addClass(ts.css.stickyHide)
|
1771
|
+
.css({
|
1772
|
+
position : $attach.length ? 'absolute' : 'fixed',
|
1773
|
+
padding : parseInt( $stickyTable.parent().parent().css('padding-left'), 10 ),
|
1774
|
+
top : stickyOffset + nestedStickyTop,
|
1775
|
+
left : 0,
|
1776
|
+
visibility : 'hidden',
|
1777
|
+
zIndex : wo.stickyHeaders_zIndex || 2
|
1778
|
+
}),
|
1761
1779
|
$stickyThead = $stickyTable.children('thead:first'),
|
1762
1780
|
$stickyCells,
|
1763
1781
|
laststate = '',
|
@@ -1800,6 +1818,10 @@ ts.addWidget({
|
|
1800
1818
|
setWidth( $table, $stickyTable );
|
1801
1819
|
setWidth( $header, $stickyCells );
|
1802
1820
|
};
|
1821
|
+
// only add a position relative if a position isn't already defined
|
1822
|
+
if ($attach.length && !$attach.css('position')) {
|
1823
|
+
$attach.css('position', 'relative');
|
1824
|
+
}
|
1803
1825
|
// save stickyTable element to config
|
1804
1826
|
// it is also saved to wo.$sticky
|
1805
1827
|
if (c.$extraTables && c.$extraTables.length) {
|
@@ -1846,8 +1868,7 @@ ts.addWidget({
|
|
1846
1868
|
if (!$table.is(':visible')) { return; } // fixes #278
|
1847
1869
|
// Detect nested tables - fixes #724
|
1848
1870
|
nestedStickyTop = $nestedSticky.length ? $nestedSticky.offset().top - $yScroll.scrollTop() + $nestedSticky.height() : 0;
|
1849
|
-
var
|
1850
|
-
offset = $table.offset(),
|
1871
|
+
var offset = $table.offset(),
|
1851
1872
|
yWindow = $.isWindow( $yScroll[0] ), // $.isWindow needs jQuery 1.4.3
|
1852
1873
|
xWindow = $.isWindow( $xScroll[0] ),
|
1853
1874
|
// scrollTop = ( $attach.length ? $attach.offset().top : $yScroll.scrollTop() ) + stickyOffset + nestedStickyTop,
|
@@ -1857,7 +1878,7 @@ ts.addWidget({
|
|
1857
1878
|
cssSettings = { visibility : isVisible };
|
1858
1879
|
|
1859
1880
|
if ($attach.length) {
|
1860
|
-
cssSettings.top = yWindow ? scrollTop : $attach.scrollTop();
|
1881
|
+
cssSettings.top = yWindow ? scrollTop - $attach.offset().top : $attach.scrollTop();
|
1861
1882
|
}
|
1862
1883
|
if (xWindow) {
|
1863
1884
|
// adjust when scrolling horizontally - fixes issue #143
|
@@ -1867,8 +1888,8 @@ ts.addWidget({
|
|
1867
1888
|
cssSettings.top = ( cssSettings.top || 0 ) + stickyOffset + nestedStickyTop;
|
1868
1889
|
}
|
1869
1890
|
$stickyWrap
|
1870
|
-
.removeClass(
|
1871
|
-
.addClass(
|
1891
|
+
.removeClass( ts.css.stickyVis + ' ' + ts.css.stickyHide )
|
1892
|
+
.addClass( isVisible === 'visible' ? ts.css.stickyVis : ts.css.stickyHide )
|
1872
1893
|
.css(cssSettings);
|
1873
1894
|
if (isVisible !== laststate || event.type === 'resize') {
|
1874
1895
|
// make sure the column widths match
|
@@ -0,0 +1,93 @@
|
|
1
|
+
/*!
|
2
|
+
* Range date parsers
|
3
|
+
* 2/23/2015 (v2.21.0)
|
4
|
+
*/
|
5
|
+
/* Include the widget-filter-type-insideRange.js to filter ranges */
|
6
|
+
/*jshint jquery:true */
|
7
|
+
;(function($){
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
var regex = {
|
11
|
+
mdy : /(\d{1,2}[-\s]\d{1,2}[-\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/gi,
|
12
|
+
|
13
|
+
dmy : /(\d{1,2}[-\s]\d{1,2}[-\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/gi,
|
14
|
+
dmyreplace : /(\d{1,2})[-\s](\d{1,2})[-\s](\d{4})/,
|
15
|
+
|
16
|
+
ymd : /(\d{4}[-\s]\d{1,2}[-\s]\d{1,2}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/gi,
|
17
|
+
ymdreplace : /(\d{4})[-\s](\d{1,2})[-\s](\d{1,2})/
|
18
|
+
};
|
19
|
+
|
20
|
+
/*! date-range MMDDYYYY *//* (2/15/2000 - 5/18/2000) */
|
21
|
+
$.tablesorter.addParser({
|
22
|
+
id: 'date-range-mdy',
|
23
|
+
is: function () {
|
24
|
+
return false;
|
25
|
+
},
|
26
|
+
format: function (text) {
|
27
|
+
var date, str, i, len,
|
28
|
+
parsed = [];
|
29
|
+
str = text.replace( /\s+/g, ' ' ).replace( /[\/\-.,]/g, '-' ).match( regex.mdy );
|
30
|
+
len = str && str.length;
|
31
|
+
// work on dates, even if there is no range
|
32
|
+
if ( len ) {
|
33
|
+
for (i = 0; i < len; i++) {
|
34
|
+
date = new Date( str[i] );
|
35
|
+
parsed.push( date instanceof Date && isFinite(date) ? date.getTime() : str[i] );
|
36
|
+
}
|
37
|
+
// sort from min to max
|
38
|
+
return parsed.sort().join( ' - ' );
|
39
|
+
}
|
40
|
+
return text;
|
41
|
+
},
|
42
|
+
type: 'text'
|
43
|
+
});
|
44
|
+
|
45
|
+
/*! date-range DDMMYYYY *//* (15/2/2000 - 18/5/2000) */
|
46
|
+
$.tablesorter.addParser({
|
47
|
+
id: 'date-range-dmy',
|
48
|
+
is: function () {
|
49
|
+
return false;
|
50
|
+
},
|
51
|
+
format: function (text) {
|
52
|
+
var date, str, i, len,
|
53
|
+
parsed = [];
|
54
|
+
str = text.replace( /\s+/g, ' ' ).replace( /[\/\-.,]/g, '-' ).match( regex.dmy );
|
55
|
+
len = str && str.length;
|
56
|
+
if ( len ) {
|
57
|
+
for (i = 0; i < len; i++) {
|
58
|
+
date = new Date( ( '' + str[i] ).replace( regex.dmyreplace, '$2/$1/$3' ) );
|
59
|
+
parsed.push( date instanceof Date && isFinite(date) ? date.getTime() : str[i] );
|
60
|
+
}
|
61
|
+
// sort from min to max
|
62
|
+
return parsed.sort().join( ' - ' );
|
63
|
+
}
|
64
|
+
return text;
|
65
|
+
},
|
66
|
+
type: 'text'
|
67
|
+
});
|
68
|
+
|
69
|
+
/*! date-range DDMMYYYY *//* (2000/2/15 - 2000/5/18) */
|
70
|
+
$.tablesorter.addParser({
|
71
|
+
id: 'date-range-ymd',
|
72
|
+
is: function () {
|
73
|
+
return false;
|
74
|
+
},
|
75
|
+
format: function (text) {
|
76
|
+
var date, str, i, len,
|
77
|
+
parsed = [];
|
78
|
+
str = text.replace( /\s+/g, ' ' ).replace( /[\/\-.,]/g, '-' ).match( regex.ymd );
|
79
|
+
len = str && str.length;
|
80
|
+
if ( len ) {
|
81
|
+
for (i = 0; i < len; i++) {
|
82
|
+
date = new Date( ( '' + str[i] ).replace( regex.ymdreplace, '$2/$3/$1' ) );
|
83
|
+
parsed.push( date instanceof Date && isFinite(date) ? date.getTime() : str[i] );
|
84
|
+
}
|
85
|
+
// sort from min to max
|
86
|
+
return parsed.sort().join( ' - ' );
|
87
|
+
}
|
88
|
+
return text;
|
89
|
+
},
|
90
|
+
type: 'text'
|
91
|
+
});
|
92
|
+
|
93
|
+
})(jQuery);
|