jquery-tablesorter 1.10.1 → 1.10.10
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.
- checksums.yaml +4 -4
- data/{README.markdown → README.md} +8 -3
- data/Rakefile +39 -35
- data/lib/jquery-tablesorter/version.rb +1 -1
- data/lib/jquery-tablesorter.rb +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +66 -29
- data/vendor/assets/javascripts/jquery-tablesorter/extras/jquery.quicksearch.js +191 -0
- data/vendor/assets/javascripts/jquery-tablesorter/extras/semver-mod.js +1026 -0
- data/vendor/assets/javascripts/jquery-tablesorter/extras/semver.js +1011 -0
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +156 -99
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets-filter-formatter.js +22 -22
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +68 -42
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-iso8601.js +34 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js +33 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-two-digit-year.js +74 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-weekday.js +33 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date.js +36 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-feet-inch-fraction.js +63 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-file-type.js +73 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-ignore-articles.js +47 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-input-select.js +87 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-ipv6.js +76 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-metric.js +77 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-alignChar.js +145 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-build-table.js +441 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columnSelector.js +306 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-cssStickyHeaders.js +67 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-editable.js +89 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-grouping.js +249 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-headerTitles.js +91 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +864 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-repeatheaders.js +50 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-scroller.js +241 -0
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.black-ice.css +4 -0
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.blue.css +4 -0
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.bootstrap.css +14 -5
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.bootstrap_2.css +4 -0
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.dark.css +4 -0
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.default.css +4 -0
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.dropbox.css +4 -0
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.green.css +4 -0
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.grey.css +4 -0
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.ice.css +4 -0
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.jui.css +9 -3
- metadata +28 -12
- data/vendor/assets/images/jquery-tablesorter/dropbox-asc1.png +0 -0
- data/vendor/assets/images/jquery-tablesorter/dropbox-asc2.png +0 -0
- data/vendor/assets/images/jquery-tablesorter/dropbox-desc1.png +0 -0
- data/vendor/assets/images/jquery-tablesorter/dropbox-desc2.png +0 -0
- data/vendor/assets/images/jquery-tablesorter/green-asc.png +0 -0
- data/vendor/assets/images/jquery-tablesorter/green-desc.png +0 -0
- data/vendor/assets/images/jquery-tablesorter/green-header.png +0 -0
- data/vendor/assets/images/jquery-tablesorter/green-unsorted.png +0 -0
data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets-filter-formatter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Filter widget formatter functions - updated
|
|
1
|
+
/*! Filter widget formatter functions - updated 3/12/2014 (v2.15.9)
|
|
2
2
|
* requires: tableSorter 2.15+ and jQuery 1.4.3+
|
|
3
3
|
*
|
|
4
4
|
* uiSpinner (jQuery UI spinner)
|
|
@@ -70,15 +70,15 @@ tsff = ts.filterFormatter = {
|
|
|
70
70
|
disabled : false
|
|
71
71
|
|
|
72
72
|
}, spinnerDef ),
|
|
73
|
+
c = $cell.closest('table')[0].config,
|
|
73
74
|
// Add a hidden input to hold the range values
|
|
74
75
|
$input = $('<input class="filter" type="hidden">')
|
|
75
76
|
.appendTo($cell)
|
|
76
|
-
// hidden filter update
|
|
77
|
-
.bind('change.
|
|
77
|
+
// hidden filter update namespace trigger by filter widget
|
|
78
|
+
.bind('change' + c.namespace + 'filter', function(){
|
|
78
79
|
updateSpinner({ value: this.value, delayed: false });
|
|
79
80
|
}),
|
|
80
81
|
$shcell = [],
|
|
81
|
-
c = $cell.closest('table')[0].config,
|
|
82
82
|
|
|
83
83
|
// this function updates the hidden input and adds the current values to the header cell text
|
|
84
84
|
updateSpinner = function(ui, notrigger) {
|
|
@@ -227,15 +227,15 @@ tsff = ts.filterFormatter = {
|
|
|
227
227
|
step : 1,
|
|
228
228
|
range : "min"
|
|
229
229
|
}, sliderDef ),
|
|
230
|
+
c = $cell.closest('table')[0].config,
|
|
230
231
|
// Add a hidden input to hold the range values
|
|
231
232
|
$input = $('<input class="filter" type="hidden">')
|
|
232
233
|
.appendTo($cell)
|
|
233
|
-
// hidden filter update
|
|
234
|
-
.bind('change.
|
|
234
|
+
// hidden filter update namespace trigger by filter widget
|
|
235
|
+
.bind('change' + c.namespace + 'filter', function(){
|
|
235
236
|
updateSlider({ value: this.value });
|
|
236
237
|
}),
|
|
237
238
|
$shcell = [],
|
|
238
|
-
c = $cell.closest('table')[0].config,
|
|
239
239
|
|
|
240
240
|
// this function updates the hidden input and adds the current values to the header cell text
|
|
241
241
|
updateSlider = function(ui, notrigger) {
|
|
@@ -365,15 +365,15 @@ tsff = ts.filterFormatter = {
|
|
|
365
365
|
max : 100,
|
|
366
366
|
range : true
|
|
367
367
|
}, rangeDef ),
|
|
368
|
+
c = $cell.closest('table')[0].config,
|
|
368
369
|
// Add a hidden input to hold the range values
|
|
369
370
|
$input = $('<input class="filter" type="hidden">')
|
|
370
371
|
.appendTo($cell)
|
|
371
|
-
// hidden filter update
|
|
372
|
-
.bind('change.
|
|
372
|
+
// hidden filter update namespace trigger by filter widget
|
|
373
|
+
.bind('change' + c.namespace + 'filter', function(){
|
|
373
374
|
getRange();
|
|
374
375
|
}),
|
|
375
376
|
$shcell = [],
|
|
376
|
-
c = $cell.closest('table')[0].config,
|
|
377
377
|
|
|
378
378
|
getRange = function(){
|
|
379
379
|
var val = $input.val(),
|
|
@@ -487,7 +487,7 @@ tsff = ts.filterFormatter = {
|
|
|
487
487
|
endOfDay : true,
|
|
488
488
|
// include ANY jQuery UI spinner options below
|
|
489
489
|
|
|
490
|
-
defaultDate : '',
|
|
490
|
+
defaultDate : '',
|
|
491
491
|
|
|
492
492
|
changeMonth : true,
|
|
493
493
|
changeYear : true,
|
|
@@ -495,20 +495,20 @@ tsff = ts.filterFormatter = {
|
|
|
495
495
|
}, defDate),
|
|
496
496
|
|
|
497
497
|
$date,
|
|
498
|
+
c = $cell.closest('table')[0].config,
|
|
498
499
|
// make sure we're using parsed dates in the search
|
|
499
500
|
$hdr = $cell.closest('thead').find('th[data-column=' + indx + ']').addClass('filter-parsed'),
|
|
500
501
|
// Add a hidden input to hold the range values
|
|
501
502
|
$input = $('<input class="dateCompare" type="hidden">')
|
|
502
503
|
.appendTo($cell)
|
|
503
|
-
// hidden filter update
|
|
504
|
-
.bind('change.
|
|
504
|
+
// hidden filter update namespace trigger by filter widget
|
|
505
|
+
.bind('change' + c.namespace + 'filter', function(){
|
|
505
506
|
var v = this.value;
|
|
506
507
|
if (v) {
|
|
507
508
|
o.onClose(v);
|
|
508
509
|
}
|
|
509
510
|
}),
|
|
510
511
|
t, $shcell = [],
|
|
511
|
-
c = $cell.closest('table')[0].config,
|
|
512
512
|
|
|
513
513
|
// this function updates the hidden input
|
|
514
514
|
date1Compare = function(v, notrigger) {
|
|
@@ -629,11 +629,12 @@ tsff = ts.filterFormatter = {
|
|
|
629
629
|
numberOfMonths : 1
|
|
630
630
|
}, defDate),
|
|
631
631
|
t, closeTo, closeFrom, $shcell = [],
|
|
632
|
+
c = $cell.closest('table')[0].config,
|
|
632
633
|
// Add a hidden input to hold the range values
|
|
633
634
|
$input = $('<input class="dateRange" type="hidden">')
|
|
634
635
|
.appendTo($cell)
|
|
635
|
-
// hidden filter update
|
|
636
|
-
.bind('change.
|
|
636
|
+
// hidden filter update namespace trigger by filter widget
|
|
637
|
+
.bind('change' + c.namespace + 'filter', function(){
|
|
637
638
|
var v = this.value;
|
|
638
639
|
if (v.match(' - ')) {
|
|
639
640
|
v = v.split(' - ');
|
|
@@ -644,8 +645,7 @@ tsff = ts.filterFormatter = {
|
|
|
644
645
|
} else if (v.match('<=')) {
|
|
645
646
|
closeTo( v.replace('<=', '') );
|
|
646
647
|
}
|
|
647
|
-
})
|
|
648
|
-
c = $cell.closest('table')[0].config;
|
|
648
|
+
});
|
|
649
649
|
|
|
650
650
|
// make sure we're using parsed dates in the search
|
|
651
651
|
$cell.closest('thead').find('th[data-column=' + indx + ']').addClass('filter-parsed');
|
|
@@ -940,8 +940,8 @@ tsff = ts.filterFormatter = {
|
|
|
940
940
|
.addClass('filter-parsed') // get exact numbers from column
|
|
941
941
|
// add span to header for the current slider value
|
|
942
942
|
.find('.tablesorter-header-inner').append('<span class="curvalue" />');
|
|
943
|
-
// hidden filter update
|
|
944
|
-
$input = $cell.find('input[type=hidden]').bind('change.
|
|
943
|
+
// hidden filter update namespace trigger by filter widget
|
|
944
|
+
$input = $cell.find('input[type=hidden]').bind('change' + c.namespace + 'filter', function(){
|
|
945
945
|
/*jshint eqeqeq:false */
|
|
946
946
|
var v = this.value,
|
|
947
947
|
compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '';
|
|
@@ -1085,8 +1085,8 @@ tsff = ts.filterFormatter = {
|
|
|
1085
1085
|
updateColor( $cell.find('.colorpicker').val() );
|
|
1086
1086
|
});
|
|
1087
1087
|
|
|
1088
|
-
// hidden filter update
|
|
1089
|
-
$input = $cell.find('input[type=hidden]').bind('change.
|
|
1088
|
+
// hidden filter update namespace trigger by filter widget
|
|
1089
|
+
$input = $cell.find('input[type=hidden]').bind('change' + c.namespace + 'filter', function(){
|
|
1090
1090
|
updateColor( this.value );
|
|
1091
1091
|
});
|
|
1092
1092
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! tableSorter 2.
|
|
1
|
+
/*! tableSorter 2.15+ widgets - updated 4/3/2014 (v2.15.13)
|
|
2
2
|
*
|
|
3
3
|
* Column Styles
|
|
4
4
|
* Column Filters
|
|
@@ -125,7 +125,7 @@ ts.storage = function(table, key, value, options) {
|
|
|
125
125
|
document.cookie = key + '=' + (JSON.stringify(values)).replace(/\"/g,'\"') + '; expires=' + date.toGMTString() + '; path=/';
|
|
126
126
|
}
|
|
127
127
|
} else {
|
|
128
|
-
return values && values[url] ? values[url][id] :
|
|
128
|
+
return values && values[url] ? values[url][id] : '';
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
131
|
|
|
@@ -380,7 +380,7 @@ ts.addWidget({
|
|
|
380
380
|
$table
|
|
381
381
|
.removeClass('hasFilters')
|
|
382
382
|
// add .tsfilter namespace to all BUT search
|
|
383
|
-
.unbind('addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search '.split(' ').join(
|
|
383
|
+
.unbind('addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search '.split(' ').join(c.namespace + 'filter '))
|
|
384
384
|
.find('.' + ts.css.filterRow).remove();
|
|
385
385
|
for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
|
|
386
386
|
$tbody = ts.processTbody(table, $tbodies.eq(tbodyIndex), true); // remove tbody
|
|
@@ -558,7 +558,7 @@ ts.filter = {
|
|
|
558
558
|
ts.filter.buildRow(table, c, wo);
|
|
559
559
|
}
|
|
560
560
|
|
|
561
|
-
c.$table.bind('addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search '.split(' ').join(
|
|
561
|
+
c.$table.bind('addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search '.split(' ').join(c.namespace + 'filter '), function(event, filter) {
|
|
562
562
|
c.$table.find('.' + ts.css.filterRow).toggle( !(wo.filter_hideEmpty && $.isEmptyObject(c.cache)) ); // fixes #450
|
|
563
563
|
if ( !/(search|filter)/.test(event.type) ) {
|
|
564
564
|
event.stopPropagation();
|
|
@@ -571,11 +571,11 @@ ts.filter = {
|
|
|
571
571
|
} else {
|
|
572
572
|
// send false argument to force a new search; otherwise if the filter hasn't changed, it will return
|
|
573
573
|
filter = event.type === 'search' ? filter : event.type === 'updateComplete' ? c.$table.data('lastSearch') : '';
|
|
574
|
-
if (/(update|add)/.test(event.type)) {
|
|
574
|
+
if (/(update|add)/.test(event.type) && event.type !== "updateComplete") {
|
|
575
575
|
// force a new search since content has changed
|
|
576
576
|
c.lastCombinedFilter = null;
|
|
577
577
|
}
|
|
578
|
-
// pass true (
|
|
578
|
+
// pass true (skipFirst) to prevent the tablesorter.setFilters function from skipping the first input
|
|
579
579
|
// ensures all inputs are updated when a search is triggered on the table $('table').trigger('search', [...]);
|
|
580
580
|
ts.filter.searching(table, filter, true);
|
|
581
581
|
}
|
|
@@ -628,7 +628,7 @@ ts.filter = {
|
|
|
628
628
|
|
|
629
629
|
// show processing icon
|
|
630
630
|
if (c.showProcessing) {
|
|
631
|
-
c.$table.bind('filterStart.
|
|
631
|
+
c.$table.bind('filterStart' + c.namespace + 'filter filterEnd' + c.namespace + 'filter', function(event, columns) {
|
|
632
632
|
// only add processing to certain columns to all columns
|
|
633
633
|
$header = (columns) ? c.$table.find('.' + ts.css.header).filter('[data-column]').filter(function() {
|
|
634
634
|
return columns[$(this).data('column')] !== '';
|
|
@@ -654,15 +654,21 @@ ts.filter = {
|
|
|
654
654
|
c.$table.trigger('filterInit');
|
|
655
655
|
},
|
|
656
656
|
setDefaults: function(table, c, wo) {
|
|
657
|
-
var isArray, saved,
|
|
657
|
+
var isArray, saved, indx,
|
|
658
658
|
// get current (default) filters
|
|
659
|
-
filters = ts.getFilters(table);
|
|
659
|
+
filters = ts.getFilters(table) || [];
|
|
660
660
|
if (wo.filter_saveFilters && ts.storage) {
|
|
661
661
|
saved = ts.storage( table, 'tablesorter-filters' ) || [];
|
|
662
662
|
isArray = $.isArray(saved);
|
|
663
663
|
// make sure we're not just getting an empty array
|
|
664
664
|
if ( !(isArray && saved.join('') === '' || !isArray) ) { filters = saved; }
|
|
665
665
|
}
|
|
666
|
+
// if no filters saved, then check default settings
|
|
667
|
+
if (filters.join('') === '') {
|
|
668
|
+
for (indx = 0; indx < c.columns; indx++) {
|
|
669
|
+
filters[indx] = c.$headers.filter('[data-column="' + indx + '"]:last').attr(wo.filter_defaultAttrib) || filters[indx];
|
|
670
|
+
}
|
|
671
|
+
}
|
|
666
672
|
c.$table.data('lastSearch', filters);
|
|
667
673
|
return filters;
|
|
668
674
|
},
|
|
@@ -674,7 +680,7 @@ ts.filter = {
|
|
|
674
680
|
for (column = 0; column < columns; column++) {
|
|
675
681
|
buildFilter += '<td></td>';
|
|
676
682
|
}
|
|
677
|
-
c.$filters = $(buildFilter += '</tr>').appendTo( c.$table.
|
|
683
|
+
c.$filters = $(buildFilter += '</tr>').appendTo( c.$table.children('thead').eq(0) ).find('td');
|
|
678
684
|
// build each filter input
|
|
679
685
|
for (column = 0; column < columns; column++) {
|
|
680
686
|
disabled = false;
|
|
@@ -745,9 +751,9 @@ ts.filter = {
|
|
|
745
751
|
$el
|
|
746
752
|
// use data attribute instead of jQuery data since the head is cloned without including the data/binding
|
|
747
753
|
.attr('data-lastSearchTime', new Date().getTime())
|
|
748
|
-
.unbind('keyup search change')
|
|
754
|
+
.unbind('keyup search change '.split(' ').join(c.namespace + 'filter '))
|
|
749
755
|
// include change for select - fixes #473
|
|
750
|
-
.bind('keyup search change', function(event, filters) {
|
|
756
|
+
.bind('keyup search change '.split(' ').join(c.namespace + 'filter '), function(event, filters) {
|
|
751
757
|
$(this).attr('data-lastSearchTime', new Date().getTime());
|
|
752
758
|
// emulate what webkit does.... escape clears the filter
|
|
753
759
|
if (event.which === 27) {
|
|
@@ -758,22 +764,22 @@ ts.filter = {
|
|
|
758
764
|
( event.which >= 37 && event.which <= 40 ) || (event.which !== 13 && wo.filter_liveSearch === false) ) ) ) {
|
|
759
765
|
return;
|
|
760
766
|
}
|
|
761
|
-
// true flag
|
|
762
|
-
ts.filter.searching( table,
|
|
767
|
+
// true flag tells getFilters to skip newest timed input
|
|
768
|
+
ts.filter.searching( table, true, true );
|
|
763
769
|
});
|
|
764
770
|
c.$table.bind('filterReset', function(){
|
|
765
771
|
$el.val('');
|
|
766
772
|
});
|
|
767
773
|
},
|
|
768
|
-
checkFilters: function(table, filter,
|
|
774
|
+
checkFilters: function(table, filter, skipFirst) {
|
|
769
775
|
var c = table.config,
|
|
770
776
|
wo = c.widgetOptions,
|
|
771
777
|
filterArray = $.isArray(filter),
|
|
772
|
-
filters = (filterArray) ? filter : ts.getFilters(table),
|
|
778
|
+
filters = (filterArray) ? filter : ts.getFilters(table, true),
|
|
773
779
|
combinedFilters = (filters || []).join(''); // combined filter values
|
|
774
780
|
// add filter array back into inputs
|
|
775
781
|
if (filterArray) {
|
|
776
|
-
ts.setFilters( table, filters, false,
|
|
782
|
+
ts.setFilters( table, filters, false, skipFirst !== true );
|
|
777
783
|
}
|
|
778
784
|
if (wo.filter_hideFilters) {
|
|
779
785
|
// show/hide filter row as needed
|
|
@@ -817,7 +823,7 @@ ts.filter = {
|
|
|
817
823
|
// $(':focus') needs jQuery 1.6+
|
|
818
824
|
if ( $(document.activeElement).closest('tr')[0] !== $filterRow[0] ) {
|
|
819
825
|
// don't hide row if any filter has a value
|
|
820
|
-
if (
|
|
826
|
+
if (c.lastCombinedFilter === '') {
|
|
821
827
|
$filterRow.addClass('hideme');
|
|
822
828
|
}
|
|
823
829
|
}
|
|
@@ -845,24 +851,24 @@ ts.filter = {
|
|
|
845
851
|
c = table.config,
|
|
846
852
|
wo = c.widgetOptions,
|
|
847
853
|
columns = c.columns,
|
|
848
|
-
$tbodies = c.$tbodies
|
|
854
|
+
$tbodies = c.$table.children('tbody'), // target all tbodies #568
|
|
849
855
|
// anyMatch really screws up with these types of filters
|
|
850
856
|
anyMatchNotAllowedTypes = [ 'range', 'notMatch', 'operators' ],
|
|
851
857
|
// parse columns after formatter, in case the class is added at that point
|
|
852
858
|
parsed = c.$headers.map(function(columnIndex) {
|
|
853
|
-
return c.parsers && c.parsers[columnIndex].parsed || ( ts.getData ?
|
|
859
|
+
return c.parsers && c.parsers[columnIndex] && c.parsers[columnIndex].parsed || ( ts.getData ?
|
|
854
860
|
ts.getData(c.$headers.filter('[data-column="' + columnIndex + '"]:last'), c.headers[columnIndex], 'filter') === 'parsed' :
|
|
855
861
|
$(this).hasClass('filter-parsed') );
|
|
856
862
|
}).get();
|
|
857
863
|
if (c.debug) { time = new Date(); }
|
|
858
864
|
for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
|
|
859
|
-
if ($tbodies.eq(tbodyIndex).hasClass(ts.css.info)) { continue; } // ignore info blocks, issue #264
|
|
865
|
+
if ($tbodies.eq(tbodyIndex).hasClass(c.cssInfoBlock || ts.css.info)) { continue; } // ignore info blocks, issue #264
|
|
860
866
|
$tbody = ts.processTbody(table, $tbodies.eq(tbodyIndex), true);
|
|
861
867
|
// skip child rows & widget added (removable) rows - fixes #448 thanks to @hempel!
|
|
862
868
|
$rows = $tbody.children('tr').not(c.selectorRemove);
|
|
863
869
|
len = $rows.length;
|
|
864
870
|
if (combinedFilters === '' || wo.filter_serversideFiltering) {
|
|
865
|
-
$tbody.children().not('.' + c.cssChildRow).show()
|
|
871
|
+
$tbody.children().removeClass(wo.filter_filteredRow).not('.' + c.cssChildRow).show();
|
|
866
872
|
} else {
|
|
867
873
|
// optimize searching only through already filtered rows - see #313
|
|
868
874
|
searchFiltered = true;
|
|
@@ -984,13 +990,11 @@ ts.filter = {
|
|
|
984
990
|
showRow = (result) ? showRow : false;
|
|
985
991
|
}
|
|
986
992
|
}
|
|
987
|
-
$rows
|
|
988
|
-
|
|
993
|
+
$rows.eq(rowIndex)
|
|
994
|
+
.toggle(showRow)
|
|
995
|
+
.toggleClass(wo.filter_filteredRow, !showRow);
|
|
989
996
|
if (childRow.length) {
|
|
990
|
-
|
|
991
|
-
childRow[showRow ? 'removeClass' : 'addClass'](wo.filter_filteredRow); // see issue #396
|
|
992
|
-
}
|
|
993
|
-
childRow.toggle(showRow);
|
|
997
|
+
childRow.toggleClass(wo.filter_filteredRow, !showRow);
|
|
994
998
|
}
|
|
995
999
|
cacheIndex++;
|
|
996
1000
|
}
|
|
@@ -1010,8 +1014,9 @@ ts.filter = {
|
|
|
1010
1014
|
c.$table.trigger('filterEnd');
|
|
1011
1015
|
},
|
|
1012
1016
|
buildSelect: function(table, column, updating, onlyavail) {
|
|
1017
|
+
if (!table.config.cache || $.isEmptyObject(table.config.cache)) { return; }
|
|
1013
1018
|
column = parseInt(column, 10);
|
|
1014
|
-
var indx, rowIndex, tbodyIndex, len, currentValue, txt,
|
|
1019
|
+
var indx, rowIndex, tbodyIndex, len, currentValue, txt, $filters,
|
|
1015
1020
|
c = table.config,
|
|
1016
1021
|
wo = c.widgetOptions,
|
|
1017
1022
|
$tbodies = c.$tbodies,
|
|
@@ -1054,7 +1059,12 @@ ts.filter = {
|
|
|
1054
1059
|
options += arry[indx] !== '' ? '<option value="' + txt + '"' + (currentValue === txt ? ' selected="selected"' : '') +
|
|
1055
1060
|
'>' + arry[indx] + '</option>' : '';
|
|
1056
1061
|
}
|
|
1057
|
-
|
|
1062
|
+
// update all selects in the same column (clone thead in sticky headers & any external selects) - fixes 473
|
|
1063
|
+
$filters = ( c.$filters ? c.$filters : c.$table.children('thead') ).find('.' + ts.css.filter);
|
|
1064
|
+
if (wo.filter_$externalFilters) {
|
|
1065
|
+
$filters = $filters && $filters.length ? $filters.add(wo.filter_$externalFilters) : wo.filter_$externalFilters;
|
|
1066
|
+
}
|
|
1067
|
+
$filters.filter('select[data-column="' + column + '"]')[ updating ? 'html' : 'append' ](options);
|
|
1058
1068
|
},
|
|
1059
1069
|
buildDefault: function(table, updating) {
|
|
1060
1070
|
var columnIndex, $header,
|
|
@@ -1073,17 +1083,17 @@ ts.filter = {
|
|
|
1073
1083
|
}
|
|
1074
1084
|
}
|
|
1075
1085
|
},
|
|
1076
|
-
searching: function(table, filter,
|
|
1086
|
+
searching: function(table, filter, skipFirst) {
|
|
1077
1087
|
if (typeof filter === 'undefined' || filter === true) {
|
|
1078
1088
|
var wo = table.config.widgetOptions;
|
|
1079
1089
|
// delay filtering
|
|
1080
1090
|
clearTimeout(wo.searchTimer);
|
|
1081
1091
|
wo.searchTimer = setTimeout(function() {
|
|
1082
|
-
ts.filter.checkFilters(table, filter,
|
|
1092
|
+
ts.filter.checkFilters(table, filter, skipFirst );
|
|
1083
1093
|
}, wo.filter_liveSearch ? wo.filter_searchDelay : 10);
|
|
1084
1094
|
} else {
|
|
1085
1095
|
// skip delay
|
|
1086
|
-
ts.filter.checkFilters(table, filter,
|
|
1096
|
+
ts.filter.checkFilters(table, filter, skipFirst);
|
|
1087
1097
|
}
|
|
1088
1098
|
}
|
|
1089
1099
|
};
|
|
@@ -1092,7 +1102,7 @@ ts.getFilters = function(table, getRaw, setFilters, skipFirst) {
|
|
|
1092
1102
|
var i, $filters, $column,
|
|
1093
1103
|
filters = false,
|
|
1094
1104
|
c = table ? $(table)[0].config : '',
|
|
1095
|
-
wo =
|
|
1105
|
+
wo = c ? c.widgetOptions : '';
|
|
1096
1106
|
if (getRaw !== true && wo && !wo.filter_columnFilters) {
|
|
1097
1107
|
return $(table).data('lastSearch');
|
|
1098
1108
|
}
|
|
@@ -1110,7 +1120,7 @@ ts.getFilters = function(table, getRaw, setFilters, skipFirst) {
|
|
|
1110
1120
|
if ($column.length) {
|
|
1111
1121
|
// move the latest search to the first slot in the array
|
|
1112
1122
|
$column = $column.sort(function(a, b){
|
|
1113
|
-
return $(
|
|
1123
|
+
return $(b).attr('data-lastSearchTime') - $(a).attr('data-lastSearchTime');
|
|
1114
1124
|
});
|
|
1115
1125
|
if ($.isArray(setFilters)) {
|
|
1116
1126
|
// skip first (latest input) to maintain cursor position while typing
|
|
@@ -1224,8 +1234,8 @@ ts.addWidget({
|
|
|
1224
1234
|
// fix clone ID, if it exists - fixes #271
|
|
1225
1235
|
if ($stickyTable.attr('id')) { $stickyTable[0].id += wo.stickyHeaders_cloneId; }
|
|
1226
1236
|
// clear out cloned table, except for sticky header
|
|
1227
|
-
// include caption & filter row (fixes #126 & #249)
|
|
1228
|
-
$stickyTable.find('thead:gt(0), tr.sticky-false, tbody, tfoot').
|
|
1237
|
+
// include caption & filter row (fixes #126 & #249) - don't remove cells to get correct cell indexing
|
|
1238
|
+
$stickyTable.find('thead:gt(0), tr.sticky-false, tbody, tfoot').hide();
|
|
1229
1239
|
if (!wo.stickyHeaders_includeCaption) {
|
|
1230
1240
|
$stickyTable.find('caption').remove();
|
|
1231
1241
|
} else {
|
|
@@ -1336,11 +1346,13 @@ ts.addWidget({
|
|
|
1336
1346
|
priority: 40,
|
|
1337
1347
|
options: {
|
|
1338
1348
|
resizable : true,
|
|
1339
|
-
resizable_addLastColumn : false
|
|
1349
|
+
resizable_addLastColumn : false,
|
|
1350
|
+
resizable_widths : []
|
|
1340
1351
|
},
|
|
1341
1352
|
format: function(table, c, wo) {
|
|
1342
1353
|
if (c.$table.hasClass('hasResizable')) { return; }
|
|
1343
1354
|
c.$table.addClass('hasResizable');
|
|
1355
|
+
ts.resizableReset(table, true); // set default widths
|
|
1344
1356
|
var $rows, $columns, $column, column,
|
|
1345
1357
|
storedSizes = {},
|
|
1346
1358
|
$table = c.$table,
|
|
@@ -1356,7 +1368,8 @@ ts.addWidget({
|
|
|
1356
1368
|
$target.width( storedSizes[$target.index()] );
|
|
1357
1369
|
$next.width( storedSizes[$next.index()] );
|
|
1358
1370
|
if (wo.resizable !== false) {
|
|
1359
|
-
|
|
1371
|
+
// save all column widths
|
|
1372
|
+
ts.storage(table, 'tablesorter-resizable', c.$headers.map(function(){ return $(this).width(); }).get() );
|
|
1360
1373
|
}
|
|
1361
1374
|
}
|
|
1362
1375
|
mouseXPosition = 0;
|
|
@@ -1451,10 +1464,23 @@ ts.addWidget({
|
|
|
1451
1464
|
ts.resizableReset(table);
|
|
1452
1465
|
}
|
|
1453
1466
|
});
|
|
1454
|
-
ts.resizableReset = function(table) {
|
|
1467
|
+
ts.resizableReset = function(table, nosave) {
|
|
1455
1468
|
$(table).each(function(){
|
|
1456
|
-
|
|
1457
|
-
|
|
1469
|
+
var $t,
|
|
1470
|
+
c = this.config,
|
|
1471
|
+
wo = c && c.widgetOptions;
|
|
1472
|
+
if (table && c) {
|
|
1473
|
+
c.$headers.each(function(i){
|
|
1474
|
+
$t = $(this);
|
|
1475
|
+
if (wo.resizable_widths[i]) {
|
|
1476
|
+
$t.css('width', wo.resizable_widths[i]);
|
|
1477
|
+
} else if (!$t.hasClass('resizable-false')) {
|
|
1478
|
+
// don't clear the width of any column that is not resizable
|
|
1479
|
+
$t.css('width','');
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
if (ts.storage && !nosave) { ts.storage(this, 'tablesorter-resizable', {}); }
|
|
1483
|
+
}
|
|
1458
1484
|
});
|
|
1459
1485
|
};
|
|
1460
1486
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*! ISO-8601 date parser
|
|
2
|
+
* This parser will work with dates in ISO8601 format
|
|
3
|
+
* 2013-02-18T18:18:44+00:00
|
|
4
|
+
* Written by Sean Ellingham :https://github.com/seanellingham
|
|
5
|
+
* See https://github.com/Mottie/tablesorter/issues/247
|
|
6
|
+
*/
|
|
7
|
+
/*global jQuery: false */
|
|
8
|
+
;(function($){
|
|
9
|
+
"use strict";
|
|
10
|
+
|
|
11
|
+
var iso8601date = /^([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?$/;
|
|
12
|
+
$.tablesorter.addParser({
|
|
13
|
+
id : 'iso8601date',
|
|
14
|
+
is : function(s) {
|
|
15
|
+
return s.match(iso8601date);
|
|
16
|
+
},
|
|
17
|
+
format : function(s) {
|
|
18
|
+
var result = s.match(iso8601date);
|
|
19
|
+
if (result) {
|
|
20
|
+
var date = new Date(result[1], 0, 1);
|
|
21
|
+
if (result[3]) { date.setMonth(result[3] - 1); }
|
|
22
|
+
if (result[5]) { date.setDate(result[5]); }
|
|
23
|
+
if (result[7]) { date.setHours(result[7]); }
|
|
24
|
+
if (result[8]) { date.setMinutes(result[8]); }
|
|
25
|
+
if (result[10]) { date.setSeconds(result[10]); }
|
|
26
|
+
if (result[12]) { date.setMilliseconds(Number('0.' + result[12]) * 1000); }
|
|
27
|
+
return date;
|
|
28
|
+
}
|
|
29
|
+
return s;
|
|
30
|
+
},
|
|
31
|
+
type : 'numeric'
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
})(jQuery);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*! Month parser
|
|
2
|
+
* Demo: http://jsfiddle.net/Mottie/abkNM/477/
|
|
3
|
+
*/
|
|
4
|
+
/*jshint jquery:true */
|
|
5
|
+
;(function($){
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
var ts = $.tablesorter;
|
|
9
|
+
ts.dates = $.extend({}, ts.dates, {
|
|
10
|
+
// *** modify this array to change match the language ***
|
|
11
|
+
monthCased : [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
|
|
12
|
+
});
|
|
13
|
+
ts.dates.monthLower = ts.dates.monthCased.join(',').toLocaleLowerCase().split(',');
|
|
14
|
+
|
|
15
|
+
ts.addParser({
|
|
16
|
+
id: "month",
|
|
17
|
+
is: function(){
|
|
18
|
+
return false;
|
|
19
|
+
},
|
|
20
|
+
format: function(s, table) {
|
|
21
|
+
var j = -1, c = table.config,
|
|
22
|
+
n = c.ignoreCase ? s.toLocaleLowerCase() : s;
|
|
23
|
+
$.each(ts.dates[ 'month' + (c.ignoreCase ? 'Lower' : 'Cased') ], function(i,v){
|
|
24
|
+
if (j < 0 && n.match(v)) { j = i; }
|
|
25
|
+
});
|
|
26
|
+
// return s (original string) if there isn't a match
|
|
27
|
+
// (non-weekdays will sort separately and empty cells will sort as expected)
|
|
28
|
+
return j < 0 ? s : j;
|
|
29
|
+
},
|
|
30
|
+
type: "numeric"
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
})(jQuery);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*! Two digit year parser
|
|
2
|
+
* Demo: http://jsfiddle.net/Mottie/abkNM/427/
|
|
3
|
+
*/
|
|
4
|
+
/*jshint jquery:true */
|
|
5
|
+
;(function($){
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
var ts = $.tablesorter,
|
|
9
|
+
|
|
10
|
+
// Make the date be within +/- range of the 2 digit year
|
|
11
|
+
// so if the current year is 2020, and the 2 digit year is 80 (2080 - 2020 > 50), it becomes 1980
|
|
12
|
+
// if the 2 digit year is 50 (2050 - 2020 < 50), then it becomes 2050.
|
|
13
|
+
range = 50;
|
|
14
|
+
|
|
15
|
+
ts.dates = $.extend({}, ts.dates, {
|
|
16
|
+
regxxxxyy: /(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{2})/,
|
|
17
|
+
regyyxxxx: /(\d{2})[\/\s](\d{1,2})[\/\s](\d{1,2})/
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
ts.formatDate = function(s, regex, format, table){
|
|
21
|
+
var n = s
|
|
22
|
+
// replace separators
|
|
23
|
+
.replace(/\s+/g," ").replace(/[-.,]/g, "/")
|
|
24
|
+
// reformat xx/xx/xx to mm/dd/19yy;
|
|
25
|
+
.replace(regex, format),
|
|
26
|
+
d = new Date(n),
|
|
27
|
+
y = d.getFullYear(),
|
|
28
|
+
rng = table && table.config.dateRange || range,
|
|
29
|
+
now = new Date().getFullYear();
|
|
30
|
+
// if date > 50 years old (set range), add 100 years
|
|
31
|
+
// this will work when people start using "50" and mean "2050"
|
|
32
|
+
while (now - y > rng) {
|
|
33
|
+
y += 100;
|
|
34
|
+
}
|
|
35
|
+
return d.setFullYear(y) || s;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
$.tablesorter.addParser({
|
|
39
|
+
id: "ddmmyy",
|
|
40
|
+
is: function() {
|
|
41
|
+
return false;
|
|
42
|
+
},
|
|
43
|
+
format: function(s, table) {
|
|
44
|
+
// reformat dd/mm/yy to mm/dd/19yy;
|
|
45
|
+
return ts.formatDate(s, ts.dates.regxxxxyy, "$2/$1/19$3", table);
|
|
46
|
+
},
|
|
47
|
+
type: "numeric"
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
$.tablesorter.addParser({
|
|
51
|
+
id: "mmddyy",
|
|
52
|
+
is: function() {
|
|
53
|
+
return false;
|
|
54
|
+
},
|
|
55
|
+
format: function(s, table) {
|
|
56
|
+
// reformat mm/dd/yy to mm/dd/19yy
|
|
57
|
+
return ts.formatDate(s, ts.dates.regxxxxyy, "$1/$2/19$3", table);
|
|
58
|
+
},
|
|
59
|
+
type: "numeric"
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
$.tablesorter.addParser({
|
|
63
|
+
id: "yymmdd",
|
|
64
|
+
is: function() {
|
|
65
|
+
return false;
|
|
66
|
+
},
|
|
67
|
+
format: function(s, table) {
|
|
68
|
+
// reformat yy/mm/dd to mm/dd/19yy
|
|
69
|
+
return ts.formatDate(s, ts.dates.regyyxxxx, "$2/$3/19$1", table);
|
|
70
|
+
},
|
|
71
|
+
type: "numeric"
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
})(jQuery);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*! Weekday parser
|
|
2
|
+
* Demo: http://jsfiddle.net/Mottie/abkNM/477/
|
|
3
|
+
*/
|
|
4
|
+
/*jshint jquery:true */
|
|
5
|
+
;(function($){
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
var ts = $.tablesorter;
|
|
9
|
+
ts.dates = $.extend({}, ts.dates, {
|
|
10
|
+
// *** modify this array to change match the language ***
|
|
11
|
+
weekdayCased : [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ]
|
|
12
|
+
});
|
|
13
|
+
ts.dates.weekdayLower = ts.dates.weekdayCased.join(',').toLocaleLowerCase().split(',');
|
|
14
|
+
|
|
15
|
+
ts.addParser({
|
|
16
|
+
id: "weekday",
|
|
17
|
+
is: function(){
|
|
18
|
+
return false;
|
|
19
|
+
},
|
|
20
|
+
format: function(s, table) {
|
|
21
|
+
var j = -1, c = table.config;
|
|
22
|
+
s = c.ignoreCase ? s.toLocaleLowerCase() : s;
|
|
23
|
+
$.each(ts.dates[ 'weekday' + (c.ignoreCase ? 'Lower' : 'Cased') ], function(i,v){
|
|
24
|
+
if (j < 0 && s.match(v)) { j = i; }
|
|
25
|
+
});
|
|
26
|
+
// return s (original string) if there isn't a match
|
|
27
|
+
// (non-weekdays will sort separately and empty cells will sort as expected)
|
|
28
|
+
return j < 0 ? s : j;
|
|
29
|
+
},
|
|
30
|
+
type: "numeric"
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
})(jQuery);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Extract dates using popular natural language date parsers
|
|
3
|
+
*/
|
|
4
|
+
/*jshint jquery:true */
|
|
5
|
+
;(function($){
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
/*! Sugar (http://sugarjs.com/dates#comparing_dates)
|
|
9
|
+
* demo: http://jsfiddle.net/Mottie/abkNM/551/
|
|
10
|
+
*/
|
|
11
|
+
$.tablesorter.addParser({
|
|
12
|
+
id: "sugar",
|
|
13
|
+
is: function() {
|
|
14
|
+
return false;
|
|
15
|
+
},
|
|
16
|
+
format: function(s) {
|
|
17
|
+
return Date.create ? Date.create(s).getTime() || s : new Date(s).getTime() || s;
|
|
18
|
+
},
|
|
19
|
+
type: "numeric"
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
/*! Datejs (http://www.datejs.com/)
|
|
23
|
+
* demo: http://jsfiddle.net/Mottie/abkNM/550/
|
|
24
|
+
*/
|
|
25
|
+
$.tablesorter.addParser({
|
|
26
|
+
id: "datejs",
|
|
27
|
+
is: function() {
|
|
28
|
+
return false;
|
|
29
|
+
},
|
|
30
|
+
format: function(s) {
|
|
31
|
+
return Date.parse && Date.parse(s) || s;
|
|
32
|
+
},
|
|
33
|
+
type: "numeric"
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
})(jQuery);
|