jquery-tablesorter 1.10.4 → 1.10.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/jquery-tablesorter/version.rb +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +36 -28
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets-filter-formatter.js +15 -15
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +7 -7
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columnSelector.js +34 -22
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-headerTitles.js +70 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ae86c5a6be578e3345d4a9d6d360139e14f5117
|
4
|
+
data.tar.gz: 86e5f16bcbace09e8eab622aa11a1bc7403f7ba3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b86a226432a4b741a8b54e6f73180924524876e1a4a21b46f192f1c7e1f24fdd727c017cb1f05ff4a448944b88751177db793d1c95e765966a7809aae0beb441
|
7
|
+
data.tar.gz: 7898210ee3314a69b1c330bf9dfa9fc364288c59769f5976f6ccc4f293a9527d2dd7c22bd374e5269c03643a2cdda18ce5aecbb8444ae8ef6acb22afe3901a0f
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Simple integration of jquery-tablesorter into the asset pipeline.
|
6
6
|
|
7
|
-
Current tablesorter version: 2.15.
|
7
|
+
Current tablesorter version: 2.15.7 (3/10/2014), [documentation]
|
8
8
|
|
9
9
|
Any issue associate with the js/css files, please report to [Mottie's fork].
|
10
10
|
|
@@ -26,7 +26,7 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
Rails 3.1 and higher (tested up to 4.1)
|
28
28
|
|
29
|
-
Tested with ruby 1.9.3 - 2.1.
|
29
|
+
Tested with ruby 1.9.3 - 2.1.1
|
30
30
|
|
31
31
|
## Usage
|
32
32
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**!
|
2
|
-
* TableSorter 2.15.
|
2
|
+
* TableSorter 2.15.7 - Client-side table sorting with ease!
|
3
3
|
* @requires jQuery v1.2.6+
|
4
4
|
*
|
5
5
|
* Copyright (c) 2007 Christian Bach
|
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
var ts = this;
|
26
26
|
|
27
|
-
ts.version = "2.15.
|
27
|
+
ts.version = "2.15.7";
|
28
28
|
|
29
29
|
ts.parsers = [];
|
30
30
|
ts.widgets = [];
|
@@ -783,15 +783,15 @@
|
|
783
783
|
$table = c.$table;
|
784
784
|
// apply easy methods that trigger bound events
|
785
785
|
$table
|
786
|
-
.unbind('sortReset update updateRows updateCell updateAll addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave '.split(' ').join(
|
787
|
-
.bind("sortReset.
|
786
|
+
.unbind('sortReset update updateRows updateCell updateAll addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave '.split(' ').join(c.namespace + ' '))
|
787
|
+
.bind("sortReset" + c.namespace, function(e){
|
788
788
|
e.stopPropagation();
|
789
789
|
c.sortList = [];
|
790
790
|
setHeadersCss(table);
|
791
791
|
multisort(table);
|
792
792
|
appendToTable(table);
|
793
793
|
})
|
794
|
-
.bind("updateAll.
|
794
|
+
.bind("updateAll" + c.namespace, function(e, resort, callback){
|
795
795
|
e.stopPropagation();
|
796
796
|
table.isUpdating = true;
|
797
797
|
ts.refreshWidgets(table, true, true);
|
@@ -801,14 +801,14 @@
|
|
801
801
|
bindMethods(table);
|
802
802
|
commonUpdate(table, resort, callback);
|
803
803
|
})
|
804
|
-
.bind("update.
|
804
|
+
.bind("update" + c.namespace + " updateRows" + c.namespace, function(e, resort, callback) {
|
805
805
|
e.stopPropagation();
|
806
806
|
table.isUpdating = true;
|
807
807
|
// update sorting (if enabled/disabled)
|
808
808
|
updateHeader(table);
|
809
809
|
commonUpdate(table, resort, callback);
|
810
810
|
})
|
811
|
-
.bind("updateCell.
|
811
|
+
.bind("updateCell" + c.namespace, function(e, cell, resort, callback) {
|
812
812
|
e.stopPropagation();
|
813
813
|
table.isUpdating = true;
|
814
814
|
$table.find(c.selectorRemove).remove();
|
@@ -830,7 +830,7 @@
|
|
830
830
|
checkResort($table, resort, callback);
|
831
831
|
}
|
832
832
|
})
|
833
|
-
.bind("addRows.
|
833
|
+
.bind("addRows" + c.namespace, function(e, $row, resort, callback) {
|
834
834
|
e.stopPropagation();
|
835
835
|
table.isUpdating = true;
|
836
836
|
if (isEmptyObject(c.cache)) {
|
@@ -863,10 +863,10 @@
|
|
863
863
|
checkResort($table, resort, callback);
|
864
864
|
}
|
865
865
|
})
|
866
|
-
.bind("updateComplete.
|
866
|
+
.bind("updateComplete" + c.namespace, function(){
|
867
867
|
table.isUpdating = false;
|
868
868
|
})
|
869
|
-
.bind("sorton.
|
869
|
+
.bind("sorton" + c.namespace, function(e, list, callback, init) {
|
870
870
|
var c = table.config;
|
871
871
|
e.stopPropagation();
|
872
872
|
$table.trigger("sortStart", this);
|
@@ -885,14 +885,14 @@
|
|
885
885
|
callback(table);
|
886
886
|
}
|
887
887
|
})
|
888
|
-
.bind("appendCache.
|
888
|
+
.bind("appendCache" + c.namespace, function(e, callback, init) {
|
889
889
|
e.stopPropagation();
|
890
890
|
appendToTable(table, init);
|
891
891
|
if (typeof callback === "function") {
|
892
892
|
callback(table);
|
893
893
|
}
|
894
894
|
})
|
895
|
-
.bind("updateCache.
|
895
|
+
.bind("updateCache" + c.namespace, function(e, callback){
|
896
896
|
// rebuild parsers
|
897
897
|
if (!c.parsers) {
|
898
898
|
buildParserCache(table);
|
@@ -903,20 +903,20 @@
|
|
903
903
|
callback(table);
|
904
904
|
}
|
905
905
|
})
|
906
|
-
.bind("applyWidgetId.
|
906
|
+
.bind("applyWidgetId" + c.namespace, function(e, id) {
|
907
907
|
e.stopPropagation();
|
908
908
|
ts.getWidgetById(id).format(table, c, c.widgetOptions);
|
909
909
|
})
|
910
|
-
.bind("applyWidgets.
|
910
|
+
.bind("applyWidgets" + c.namespace, function(e, init) {
|
911
911
|
e.stopPropagation();
|
912
912
|
// apply widgets
|
913
913
|
ts.applyWidget(table, init);
|
914
914
|
})
|
915
|
-
.bind("refreshWidgets.
|
915
|
+
.bind("refreshWidgets" + c.namespace, function(e, all, dontapply){
|
916
916
|
e.stopPropagation();
|
917
917
|
ts.refreshWidgets(table, all, dontapply);
|
918
918
|
})
|
919
|
-
.bind("destroy.
|
919
|
+
.bind("destroy" + c.namespace, function(e, c, cb){
|
920
920
|
e.stopPropagation();
|
921
921
|
ts.destroy(table, c, cb);
|
922
922
|
});
|
@@ -932,8 +932,9 @@
|
|
932
932
|
if (!table.hasInitialized && ts.buildTable && this.tagName !== 'TABLE') {
|
933
933
|
// return the table (in case the original target is the table's container)
|
934
934
|
ts.buildTable(table, c);
|
935
|
+
} else {
|
936
|
+
ts.setup(table, c);
|
935
937
|
}
|
936
|
-
ts.setup(table, c);
|
937
938
|
});
|
938
939
|
};
|
939
940
|
|
@@ -972,11 +973,19 @@
|
|
972
973
|
c.$table = $table
|
973
974
|
.addClass(ts.css.table + ' ' + c.tableClass + k)
|
974
975
|
.attr({ role : 'grid'});
|
976
|
+
|
977
|
+
// give the table a unique id, which will be used in namespace binding
|
978
|
+
if (!c.namespace) {
|
979
|
+
c.namespace = '.tablesorter' + Math.random().toString(16).slice(2);
|
980
|
+
} else {
|
981
|
+
// make sure namespace starts with a period & doesn't have weird characters
|
982
|
+
c.namespace = '.' + c.namespace.replace(/\W/g,'');
|
983
|
+
}
|
984
|
+
|
975
985
|
c.$tbodies = $table.children('tbody:not(.' + c.cssInfoBlock + ')').attr({
|
976
986
|
'aria-live' : 'polite',
|
977
987
|
'aria-relevant' : 'all'
|
978
988
|
});
|
979
|
-
//
|
980
989
|
if (c.$table.find('caption').length) {
|
981
990
|
c.$table.attr('aria-labelledby', 'theCaption');
|
982
991
|
}
|
@@ -1017,8 +1026,8 @@
|
|
1017
1026
|
// show processesing icon
|
1018
1027
|
if (c.showProcessing) {
|
1019
1028
|
$table
|
1020
|
-
.unbind('sortBegin.
|
1021
|
-
.bind('sortBegin.
|
1029
|
+
.unbind('sortBegin' + c.namespace + ' sortEnd' + c.namespace)
|
1030
|
+
.bind('sortBegin' + c.namespace + ' sortEnd' + c.namespace, function(e) {
|
1022
1031
|
ts.isProcessing(table, e.type === 'sortBegin');
|
1023
1032
|
});
|
1024
1033
|
}
|
@@ -1084,8 +1093,8 @@
|
|
1084
1093
|
$headers
|
1085
1094
|
// http://stackoverflow.com/questions/5312849/jquery-find-self;
|
1086
1095
|
.find(c.selectorSort).add( $headers.filter(c.selectorSort) )
|
1087
|
-
.unbind('mousedown
|
1088
|
-
.bind('mousedown
|
1096
|
+
.unbind('mousedown mouseup sort keyup '.split(' ').join(c.namespace + ' '))
|
1097
|
+
.bind('mousedown mouseup sort keyup '.split(' ').join(c.namespace + ' '), function(e, external) {
|
1089
1098
|
var cell, type = e.type;
|
1090
1099
|
// only recognize left clicks or enter
|
1091
1100
|
if ( ((e.which || e.button) !== 1 && !/sort|keyup/.test(type)) || (type === 'keyup' && e.which !== 13) ) {
|
@@ -1146,11 +1155,11 @@
|
|
1146
1155
|
// disable tablesorter
|
1147
1156
|
$t
|
1148
1157
|
.removeData('tablesorter')
|
1149
|
-
.unbind('sortReset update updateAll updateRows updateCell addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress sortBegin sortEnd '.split(' ').join(
|
1158
|
+
.unbind('sortReset update updateAll updateRows updateCell addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress sortBegin sortEnd '.split(' ').join(c.namespace + ' '));
|
1150
1159
|
c.$headers.add($f)
|
1151
1160
|
.removeClass( [ts.css.header, c.cssHeader, c.cssAsc, c.cssDesc, ts.css.sortAsc, ts.css.sortDesc, ts.css.sortNone].join(' ') )
|
1152
1161
|
.removeAttr('data-column');
|
1153
|
-
$r.find(c.selectorSort).unbind('mousedown
|
1162
|
+
$r.find(c.selectorSort).unbind('mousedown mouseup keypress '.split(' ').join(c.namespace + ' '));
|
1154
1163
|
ts.restoreHeaders(table);
|
1155
1164
|
if (removeClasses !== false) {
|
1156
1165
|
$t.removeClass(ts.css.table + ' ' + c.tableClass + ' tablesorter-' + c.theme);
|
@@ -1166,8 +1175,7 @@
|
|
1166
1175
|
// regex used in natural sort
|
1167
1176
|
ts.regex = {
|
1168
1177
|
chunk : /(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi, // chunk/tokenize numbers & letters
|
1169
|
-
|
1170
|
-
echunk: /\\0$/, // end chunk
|
1178
|
+
chunks: /(^\\0|\\0$)/, // replace chunks @ ends
|
1171
1179
|
hex: /^0x[0-9a-f]+$/i // hex
|
1172
1180
|
};
|
1173
1181
|
|
@@ -1184,8 +1192,8 @@
|
|
1184
1192
|
if ( xD > yD ) { return 1; }
|
1185
1193
|
}
|
1186
1194
|
// chunk/tokenize
|
1187
|
-
xN = a.replace(r.chunk, '\\0$1\\0').replace(r.
|
1188
|
-
yN = b.replace(r.chunk, '\\0$1\\0').replace(r.
|
1195
|
+
xN = a.replace(r.chunk, '\\0$1\\0').replace(r.chunks, '').split('\\0');
|
1196
|
+
yN = b.replace(r.chunk, '\\0$1\\0').replace(r.chunks, '').split('\\0');
|
1189
1197
|
mx = Math.max(xN.length, yN.length);
|
1190
1198
|
// natural sorting through split numeric strings and default strings
|
1191
1199
|
for (i = 0; i < mx; i++) {
|
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/9/2014 (v2.15.7)
|
2
2
|
* requires: tableSorter 2.15+ and jQuery 1.4.3+
|
3
3
|
*
|
4
4
|
* uiSpinner (jQuery UI spinner)
|
@@ -73,8 +73,8 @@ tsff = ts.filterFormatter = {
|
|
73
73
|
// Add a hidden input to hold the range values
|
74
74
|
$input = $('<input class="filter" type="hidden">')
|
75
75
|
.appendTo($cell)
|
76
|
-
// hidden filter update
|
77
|
-
.bind('change.
|
76
|
+
// hidden filter update namespace trigger by filter widget
|
77
|
+
.bind('change' + c.namespace + 'filter', function(){
|
78
78
|
updateSpinner({ value: this.value, delayed: false });
|
79
79
|
}),
|
80
80
|
$shcell = [],
|
@@ -230,8 +230,8 @@ tsff = ts.filterFormatter = {
|
|
230
230
|
// Add a hidden input to hold the range values
|
231
231
|
$input = $('<input class="filter" type="hidden">')
|
232
232
|
.appendTo($cell)
|
233
|
-
// hidden filter update
|
234
|
-
.bind('change.
|
233
|
+
// hidden filter update namespace trigger by filter widget
|
234
|
+
.bind('change' + c.namespace + 'filter', function(){
|
235
235
|
updateSlider({ value: this.value });
|
236
236
|
}),
|
237
237
|
$shcell = [],
|
@@ -368,8 +368,8 @@ tsff = ts.filterFormatter = {
|
|
368
368
|
// Add a hidden input to hold the range values
|
369
369
|
$input = $('<input class="filter" type="hidden">')
|
370
370
|
.appendTo($cell)
|
371
|
-
// hidden filter update
|
372
|
-
.bind('change.
|
371
|
+
// hidden filter update namespace trigger by filter widget
|
372
|
+
.bind('change' + c.namespace + 'filter', function(){
|
373
373
|
getRange();
|
374
374
|
}),
|
375
375
|
$shcell = [],
|
@@ -500,8 +500,8 @@ tsff = ts.filterFormatter = {
|
|
500
500
|
// Add a hidden input to hold the range values
|
501
501
|
$input = $('<input class="dateCompare" type="hidden">')
|
502
502
|
.appendTo($cell)
|
503
|
-
// hidden filter update
|
504
|
-
.bind('change.
|
503
|
+
// hidden filter update namespace trigger by filter widget
|
504
|
+
.bind('change' + c.namespace + 'filter', function(){
|
505
505
|
var v = this.value;
|
506
506
|
if (v) {
|
507
507
|
o.onClose(v);
|
@@ -632,8 +632,8 @@ tsff = ts.filterFormatter = {
|
|
632
632
|
// Add a hidden input to hold the range values
|
633
633
|
$input = $('<input class="dateRange" type="hidden">')
|
634
634
|
.appendTo($cell)
|
635
|
-
// hidden filter update
|
636
|
-
.bind('change.
|
635
|
+
// hidden filter update namespace trigger by filter widget
|
636
|
+
.bind('change' + c.namespace + 'filter', function(){
|
637
637
|
var v = this.value;
|
638
638
|
if (v.match(' - ')) {
|
639
639
|
v = v.split(' - ');
|
@@ -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 3/9/2014 (v2.15.7)
|
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();
|
@@ -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')] !== '';
|
@@ -751,9 +751,9 @@ ts.filter = {
|
|
751
751
|
$el
|
752
752
|
// use data attribute instead of jQuery data since the head is cloned without including the data/binding
|
753
753
|
.attr('data-lastSearchTime', new Date().getTime())
|
754
|
-
.unbind('keyup search change')
|
754
|
+
.unbind('keyup search change '.split(' ').join(c.namespace + 'filter '))
|
755
755
|
// include change for select - fixes #473
|
756
|
-
.bind('keyup search change', function(event, filters) {
|
756
|
+
.bind('keyup search change '.split(' ').join(c.namespace + 'filter '), function(event, filters) {
|
757
757
|
$(this).attr('data-lastSearchTime', new Date().getTime());
|
758
758
|
// emulate what webkit does.... escape clears the filter
|
759
759
|
if (event.which === 27) {
|
@@ -32,14 +32,18 @@ tsColSel = ts.columnSelector = {
|
|
32
32
|
|
33
33
|
// build column selector/state array
|
34
34
|
colSel = c.selector = { $container : $(wo.columnSelector_container || '<div>') };
|
35
|
+
colSel.$style = $('<style></style>').prop('disabled', true).appendTo('head');
|
36
|
+
colSel.$breakpoints = $('<style></style>').prop('disabled', true).appendTo('head');
|
37
|
+
|
38
|
+
colSel.isInitializing = true;
|
35
39
|
tsColSel.setupSelector(table, c, wo);
|
36
40
|
|
37
41
|
if (wo.columnSelector_mediaquery) {
|
38
42
|
tsColSel.setupBreakpoints(c, wo);
|
39
43
|
}
|
40
44
|
|
45
|
+
colSel.isInitializing = false;
|
41
46
|
if (colSel.$container.length) {
|
42
|
-
colSel.$style = $('<style></style>').prop('disabled', true).appendTo('head');
|
43
47
|
tsColSel.updateCols(c, wo);
|
44
48
|
}
|
45
49
|
|
@@ -49,10 +53,13 @@ tsColSel = ts.columnSelector = {
|
|
49
53
|
var name,
|
50
54
|
colSel = c.selector,
|
51
55
|
$container = colSel.$container,
|
56
|
+
useStorage = wo.columnSelector_saveColumns && ts.storage,
|
52
57
|
// get stored column states
|
53
|
-
saved =
|
58
|
+
saved = useStorage ? ts.storage( table, 'tablesorter-columnSelector' ) : [],
|
59
|
+
state = useStorage ? ts.storage( table, 'tablesorter-columnSelector-auto') : {};
|
54
60
|
|
55
61
|
// initial states
|
62
|
+
colSel.auto = $.isEmptyObject(state) || $.type(state.auto) !== "boolean" ? wo.columnSelector_mediaqueryState : state.auto;
|
56
63
|
colSel.states = [];
|
57
64
|
colSel.$column = [];
|
58
65
|
colSel.$wrapper = [];
|
@@ -99,14 +106,13 @@ tsColSel = ts.columnSelector = {
|
|
99
106
|
},
|
100
107
|
|
101
108
|
setupBreakpoints: function(c, wo){
|
102
|
-
var
|
109
|
+
var colSel = c.selector;
|
103
110
|
|
104
111
|
// add responsive breakpoints
|
105
112
|
if (wo.columnSelector_mediaquery) {
|
106
113
|
// used by window resize function
|
107
114
|
colSel.lastIndex = -1;
|
108
115
|
wo.columnSelector_breakpoints.sort();
|
109
|
-
colSel.$breakpoints = $('<style></style>').prop('disabled', true).appendTo('head');
|
110
116
|
tsColSel.updateBreakpoints(c, wo);
|
111
117
|
c.$table.unbind('updateAll' + namespace).bind('updateAll' + namespace, function(){
|
112
118
|
tsColSel.updateBreakpoints(c, wo);
|
@@ -116,22 +122,24 @@ tsColSel = ts.columnSelector = {
|
|
116
122
|
|
117
123
|
if (colSel.$container.length) {
|
118
124
|
// Add media queries toggle
|
119
|
-
if (wo.columnSelector_mediaquery
|
120
|
-
|
121
|
-
|
125
|
+
if (wo.columnSelector_mediaquery) {
|
126
|
+
colSel.$auto = $( wo.columnSelector_layout.replace(/\{name\}/g, wo.columnSelector_mediaqueryName) ).prependTo(colSel.$container);
|
127
|
+
colSel.$auto
|
122
128
|
// needed in case the input in the layout is not wrapped
|
123
|
-
.find('input').add(
|
129
|
+
.find('input').add( colSel.$auto.filter('input') )
|
124
130
|
.attr('data-column', 'auto')
|
125
|
-
.prop('checked',
|
131
|
+
.prop('checked', colSel.auto)
|
126
132
|
.bind('change', function(){
|
127
|
-
|
133
|
+
colSel.auto = this.checked;
|
128
134
|
$.each( colSel.$checkbox, function(i, $cb){
|
129
135
|
if ($cb) {
|
130
|
-
$cb[0].disabled =
|
131
|
-
colSel.$wrapper[i].toggleClass('disabled',
|
136
|
+
$cb[0].disabled = colSel.auto;
|
137
|
+
colSel.$wrapper[i].toggleClass('disabled', colSel.auto);
|
132
138
|
}
|
133
139
|
});
|
134
|
-
|
140
|
+
if (wo.columnSelector_mediaquery) {
|
141
|
+
tsColSel.updateBreakpoints(c, wo);
|
142
|
+
}
|
135
143
|
tsColSel.updateCols(c, wo);
|
136
144
|
// copy the column selector to a popup/tooltip
|
137
145
|
if (c.selector.$popup) {
|
@@ -139,9 +147,12 @@ tsColSel = ts.columnSelector = {
|
|
139
147
|
.html( colSel.$container.html() )
|
140
148
|
.find('input').each(function(){
|
141
149
|
var indx = $(this).attr('data-column');
|
142
|
-
$(this).prop( 'checked', indx === 'auto' ?
|
150
|
+
$(this).prop( 'checked', indx === 'auto' ? colSel.auto : colSel.states[indx] );
|
143
151
|
});
|
144
152
|
}
|
153
|
+
if (wo.columnSelector_saveColumns && ts.storage) {
|
154
|
+
ts.storage( c.$table[0], 'tablesorter-columnSelector-auto', { auto : colSel.auto } );
|
155
|
+
}
|
145
156
|
}).change();
|
146
157
|
}
|
147
158
|
// Add a bind on update to re-run col setup
|
@@ -157,7 +168,7 @@ tsColSel = ts.columnSelector = {
|
|
157
168
|
prefix = '.' + c.tableId,
|
158
169
|
mediaAll = [],
|
159
170
|
breakpts = '';
|
160
|
-
if (wo.columnSelector_mediaquery && !
|
171
|
+
if (wo.columnSelector_mediaquery && !colSel.auto) {
|
161
172
|
colSel.$breakpoints.prop('disabled', true);
|
162
173
|
colSel.$style.prop('disabled', false);
|
163
174
|
return;
|
@@ -188,13 +199,14 @@ tsColSel = ts.columnSelector = {
|
|
188
199
|
},
|
189
200
|
|
190
201
|
updateCols: function(c, wo) {
|
191
|
-
if (wo.columnSelector_mediaquery &&
|
202
|
+
if (wo.columnSelector_mediaquery && c.selector.auto || c.selector.isInitializing) {
|
192
203
|
return;
|
193
204
|
}
|
194
205
|
var column,
|
206
|
+
colSel = c.selector,
|
195
207
|
styles = [],
|
196
208
|
prefix = '.' + c.tableId;
|
197
|
-
|
209
|
+
colSel.$container.find('input[data-column]').filter('[data-column!="auto"]').each(function(){
|
198
210
|
if (!this.checked) {
|
199
211
|
column = parseInt( $(this).attr('data-column'), 10 ) + 1;
|
200
212
|
styles.push(prefix + ' tr th:nth-child(' + column + ')');
|
@@ -202,13 +214,13 @@ tsColSel = ts.columnSelector = {
|
|
202
214
|
}
|
203
215
|
});
|
204
216
|
if (wo.columnSelector_mediaquery){
|
205
|
-
|
217
|
+
colSel.$breakpoints.prop('disabled', true);
|
206
218
|
}
|
207
|
-
if (
|
208
|
-
|
219
|
+
if (colSel.$style) {
|
220
|
+
colSel.$style.prop('disabled', false).html( styles.length ? styles.join(',') + ' { display: none; }' : '' );
|
209
221
|
}
|
210
222
|
if (wo.columnSelector_saveColumns && ts.storage) {
|
211
|
-
ts.storage( c.$table[0], 'tablesorter-columnSelector',
|
223
|
+
ts.storage( c.$table[0], 'tablesorter-columnSelector', colSel.states );
|
212
224
|
}
|
213
225
|
},
|
214
226
|
|
@@ -228,7 +240,7 @@ tsColSel = ts.columnSelector = {
|
|
228
240
|
.html( colSel.$container.html() )
|
229
241
|
.find('input').each(function(){
|
230
242
|
var indx = $(this).attr('data-column');
|
231
|
-
$(this).prop( 'checked', indx === 'auto' ?
|
243
|
+
$(this).prop( 'checked', indx === 'auto' ? colSel.auto : colSel.states[indx] );
|
232
244
|
});
|
233
245
|
colSel.$popup = $popup.on('change', 'input', function(){
|
234
246
|
// data input
|
@@ -6,26 +6,85 @@
|
|
6
6
|
/*global jQuery: false */
|
7
7
|
;(function($){
|
8
8
|
"use strict";
|
9
|
+
var ts = $.tablesorter;
|
9
10
|
|
10
|
-
|
11
|
+
ts.addWidget({
|
11
12
|
id: 'headerTitles',
|
12
13
|
options: {
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
// use aria-label text
|
15
|
+
// e.g. "First Name: Ascending sort applied, activate to apply a descending sort"
|
16
|
+
headerTitle_useAria : false,
|
17
|
+
// add tooltip class
|
18
|
+
headerTitle_tooltip : '',
|
19
|
+
// custom titles [ ascending, descending, unsorted ]
|
20
|
+
headerTitle_cur_text : [ ' sort: A - Z', ' sort: Z - A', 'ly unsorted' ],
|
21
|
+
headerTitle_cur_numeric : [ ' sort: 0 - 9', ' sort: 9 - 0', 'ly unsorted' ],
|
22
|
+
headerTitle_nxt_text : [ ' sort: A - Z', ' sort: Z - A', 'remove sort' ],
|
23
|
+
headerTitle_nxt_numeric : [ ' sort: 0 - 9', ' sort: 9 - 0', 'remove sort' ],
|
24
|
+
|
25
|
+
// title display; {prefix} adds above prefix
|
26
|
+
// {type} adds the current sort order from above (text or numeric)
|
27
|
+
// {next} adds the next sort direction using the sort order above
|
28
|
+
headerTitle_output_sorted : 'current{current}; activate to {next}',
|
29
|
+
headerTitle_output_unsorted : 'current{current}; activate to {next} ',
|
30
|
+
headerTitle_output_nosort : 'No sort available',
|
31
|
+
// use this type to override the parser detection result
|
32
|
+
// e.g. use for numerically parsed columns (e.g. dates), but you
|
33
|
+
// want the user to see a text sort, e.g. [ 'text', 'numeric' ]
|
34
|
+
headerTitle_type : [],
|
35
|
+
// manipulate the title as desired
|
36
|
+
headerTitle_callback : null // function($cell, txt) { return txt; }
|
37
|
+
},
|
38
|
+
init: function(table, thisWidget, c, wo){
|
39
|
+
// force refresh
|
40
|
+
c.$table.on('refreshHeaderTitle', function(){
|
41
|
+
thisWidget.format(table, c, wo);
|
42
|
+
});
|
43
|
+
// add tooltip class
|
44
|
+
if ($.isArray(wo.headerTitle_tooltip)) {
|
45
|
+
c.$headers.each(function(){
|
46
|
+
$(this).addClass( wo.headerTitle_tooltip[this.column] || '' );
|
47
|
+
});
|
48
|
+
} else if (wo.headerTitle_tooltip !== '') {
|
49
|
+
c.$headers.addClass( wo.headerTitle_tooltip );
|
50
|
+
}
|
16
51
|
},
|
17
52
|
format: function (table, c, wo) {
|
18
53
|
var txt;
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
54
|
+
c.$headers.each(function(){
|
55
|
+
var t = this,
|
56
|
+
$this = $(this),
|
57
|
+
sortType = wo.headerTitle_type[t.column] || c.parsers[ t.column ].type || 'text',
|
58
|
+
sortDirection = $this.hasClass(ts.css.sortAsc) ? 0 : $this.hasClass(ts.css.sortDesc) ? 1 : 2,
|
59
|
+
sortNext = t.order[(t.count + 1) % (c.sortReset ? 3 : 2)];
|
60
|
+
if (wo.headerTitle_useAria) {
|
61
|
+
txt = $this.hasClass('sorter-false') ? wo.headerTitle_output_nosort : $this.attr('aria-label') || '';
|
62
|
+
} else {
|
63
|
+
txt = (wo.headerTitle_prefix || '') + // now deprecated
|
64
|
+
($this.hasClass('sorter-false') ? wo.headerTitle_output_nosort :
|
65
|
+
ts.isValueInArray( t.column, c.sortList ) >= 0 ? wo.headerTitle_output_sorted : wo.headerTitle_output_unsorted);
|
66
|
+
txt = txt.replace(/\{(current|next|name)\}/gi, function(m){
|
67
|
+
return {
|
68
|
+
'{name}' : $this.text(),
|
69
|
+
'{current}' : wo[ 'headerTitle_cur_' + sortType ][ sortDirection ] || '',
|
70
|
+
'{next}' : wo[ 'headerTitle_nxt_' + sortType ][ sortNext ] || ''
|
71
|
+
}[m.toLowerCase()];
|
72
|
+
});
|
73
|
+
}
|
74
|
+
$this.attr('title', $.isFunction(wo.headerTitle_callback) ? wo.headerTitle_callback($this, txt) : txt);
|
25
75
|
});
|
26
76
|
},
|
27
|
-
remove: function (table, c) {
|
77
|
+
remove: function (table, c, wo) {
|
28
78
|
c.$headers.attr('title', '');
|
79
|
+
c.$table.off('refreshHeaderTitle');
|
80
|
+
// remove tooltip class
|
81
|
+
if ($.isArray(wo.headerTitle_tooltip)) {
|
82
|
+
c.$headers.each(function(){
|
83
|
+
$(this).removeClass( wo.headerTitle_tooltip[this.column] || '' );
|
84
|
+
});
|
85
|
+
} else if (wo.headerTitle_tooltip !== '') {
|
86
|
+
c.$headers.removeClass( wo.headerTitle_tooltip );
|
87
|
+
}
|
29
88
|
}
|
30
89
|
});
|
31
90
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-tablesorter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jun Lin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|