jquery-tablesorter 1.18.5 → 1.19.0
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.md +1 -1
- data/lib/jquery-tablesorter/version.rb +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +68 -46
- data/vendor/assets/javascripts/jquery-tablesorter/extras/jquery.dragtable.mod.js +3 -3
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.combined.js +2383 -2100
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +2298 -2039
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +90 -66
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js +45 -20
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-weekday.js +78 -20
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-globalize.js +37 -15
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-input-select.js +4 -4
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-chart.js +2 -2
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columnSelector.js +122 -30
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-editable.js +8 -6
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter.js +79 -58
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-grouping.js +209 -128
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-headerTitles.js +5 -4
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-lazyload.js +367 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-math.js +81 -35
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-output.js +3 -3
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +79 -53
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-print.js +25 -14
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-saveSort.js +5 -2
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-scroller.js +11 -7
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-sort2Hash.js +149 -50
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-sortTbodies.js +7 -7
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-staticRow.js +2 -2
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-stickyHeaders.js +2 -2
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-view.js +192 -0
- metadata +4 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Widget: print - updated 2/
|
|
1
|
+
/* Widget: print - updated 11/2/2015 (v2.24.1) *//*
|
|
2
2
|
* Requires tablesorter v2.8+ and jQuery 1.2.6+
|
|
3
3
|
*/
|
|
4
4
|
/*jshint browser:true, jquery:true, unused:false */
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
event : 'printTable',
|
|
14
14
|
basicStyle : 'table, tr, td, th { border : solid 1px black; border-collapse : collapse; } td, th { padding: 2px; }',
|
|
15
|
+
popupStyle : 'width=500,height=300',
|
|
15
16
|
|
|
16
17
|
init : function(c) {
|
|
17
18
|
c.$table
|
|
@@ -26,11 +27,13 @@
|
|
|
26
27
|
process : function(c, wo) {
|
|
27
28
|
var $this,
|
|
28
29
|
$table = $('<div/>').append(c.$table.clone()),
|
|
29
|
-
printStyle = printTable.basicStyle + 'table { width: 100
|
|
30
|
+
printStyle = printTable.basicStyle + 'table { width: 100%; }' +
|
|
30
31
|
// hide filter row
|
|
31
|
-
'.tablesorter-filter-row
|
|
32
|
+
'.' + ( ts.css.filterRow || 'tablesorter-filter-row' ) +
|
|
33
|
+
// hide filtered rows
|
|
34
|
+
', .' + ( wo.filter_filteredRow || 'filtered' ) + ' { display: none; }' +
|
|
32
35
|
// hide sort arrows
|
|
33
|
-
'.tablesorter-header { background-image: none !important; }';
|
|
36
|
+
'.' + ( ts.css.header || 'tablesorter-header' ) + ' { background-image: none !important; }';
|
|
34
37
|
|
|
35
38
|
// replace content with data-attribute content
|
|
36
39
|
$table.find('[' + wo.print_dataAttrib + ']').each(function(){
|
|
@@ -41,12 +44,16 @@
|
|
|
41
44
|
// === rows ===
|
|
42
45
|
// Assume 'visible' means rows hidden by the pager (rows set to 'display:none')
|
|
43
46
|
// or hidden by a class name which is added to the wo.print_extraCSS definition
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
// look for jQuery filter selector in wo.print_rows & use if found
|
|
48
|
+
if ( /^f/i.test( wo.print_rows ) ) {
|
|
49
|
+
printStyle += 'tbody tr:not(.' + ( wo.filter_filteredRow || 'filtered' ) + ') { display: table-row !important; }';
|
|
50
|
+
} else if ( /^a/i.test( wo.print_rows ) ) {
|
|
51
|
+
// default force show of all rows
|
|
46
52
|
printStyle += 'tbody tr { display: table-row !important; }';
|
|
47
|
-
} else if (
|
|
48
|
-
//
|
|
49
|
-
|
|
53
|
+
} else if ( /^[.#:\[]/.test( wo.print_rows ) ) {
|
|
54
|
+
// look for '.' (class selector), '#' (id selector),
|
|
55
|
+
// ':' (basic filters, e.g. ':not()') or '[' (attribute selector start)
|
|
56
|
+
printStyle += 'tbody tr' + wo.print_rows + ' { display: table-row !important; }';
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
// === columns ===
|
|
@@ -74,7 +81,7 @@
|
|
|
74
81
|
|
|
75
82
|
printOutput : function(c, data, style) {
|
|
76
83
|
var wo = c.widgetOptions,
|
|
77
|
-
generator = window.open('', wo.print_title,
|
|
84
|
+
generator = window.open( '', wo.print_title, printTable.popupStyle ),
|
|
78
85
|
t = wo.print_title || c.$table.find('caption').text() || c.$table[0].id || document.title || 'table';
|
|
79
86
|
generator.document.write(
|
|
80
87
|
'<html><head><title>' + t + '</title>' +
|
|
@@ -83,8 +90,12 @@
|
|
|
83
90
|
'</head><body>' + data + '</body></html>'
|
|
84
91
|
);
|
|
85
92
|
generator.document.close();
|
|
86
|
-
|
|
87
|
-
|
|
93
|
+
// use timeout to allow browser to build DOM before printing
|
|
94
|
+
// Print preview in Chrome doesn't work without this code
|
|
95
|
+
setTimeout( function() {
|
|
96
|
+
generator.print();
|
|
97
|
+
generator.close();
|
|
98
|
+
}, 10 );
|
|
88
99
|
return true;
|
|
89
100
|
},
|
|
90
101
|
|
|
@@ -99,8 +110,8 @@
|
|
|
99
110
|
options: {
|
|
100
111
|
print_title : '', // this option > caption > table id > 'table'
|
|
101
112
|
print_dataAttrib : 'data-name', // header attrib containing modified header name
|
|
102
|
-
print_rows : 'filtered', // (a)ll, (v)isible
|
|
103
|
-
print_columns : 'selected', // (a)ll or (s)elected (if columnSelector widget is added)
|
|
113
|
+
print_rows : 'filtered', // (a)ll, (v)isible, (f)iltered or custom css selector
|
|
114
|
+
print_columns : 'selected', // (a)ll, (v)isbible or (s)elected (if columnSelector widget is added)
|
|
104
115
|
print_extraCSS : '', // add any extra css definitions for the popup window here
|
|
105
116
|
print_styleSheet : '', // add the url of your print stylesheet
|
|
106
117
|
// callback executed when processing completes
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/*! Widget: saveSort
|
|
1
|
+
/*! Widget: saveSort - updated 10/31/2015 (v2.24.0) *//*
|
|
2
|
+
* Requires tablesorter v2.16+
|
|
3
|
+
* by Rob Garrison
|
|
4
|
+
*/
|
|
2
5
|
;(function ($) {
|
|
3
6
|
'use strict';
|
|
4
7
|
var ts = $.tablesorter || {};
|
|
@@ -54,7 +57,7 @@
|
|
|
54
57
|
c.sortList = sortList;
|
|
55
58
|
} else if (table.hasInitialized && sortList && sortList.length > 0) {
|
|
56
59
|
// update sort change
|
|
57
|
-
|
|
60
|
+
ts.sortOn( c, sortList );
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Widget: scroller - updated
|
|
1
|
+
/*! Widget: scroller - updated 10/31/2015 (v2.24.0) *//*
|
|
2
2
|
Copyright (C) 2011 T. Connell & Associates, Inc.
|
|
3
3
|
|
|
4
4
|
Dual-licensed under the MIT and GPL licenses
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
/* Add window resizeEnd event */
|
|
91
|
+
/* Add window resizeEnd event (also used by columnSelector widget) */
|
|
92
92
|
ts.window_resize = function() {
|
|
93
93
|
if ( ts.timer_resize ) {
|
|
94
94
|
clearTimeout( ts.timer_resize );
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
},
|
|
187
187
|
|
|
188
188
|
setup : function( c, wo ) {
|
|
189
|
-
var maxHt, tbHt, $hdr, $t, $hCells, $fCells, $tableWrap, events, tmp,
|
|
189
|
+
var maxHt, tbHt, $hdr, $t, $hCells, $fCells, $tableWrap, events, tmp, detectedWidth,
|
|
190
190
|
$win = $( window ),
|
|
191
191
|
tsScroller = ts.scroller,
|
|
192
192
|
namespace = c.namespace + 'tsscroller',
|
|
@@ -202,10 +202,14 @@
|
|
|
202
202
|
wo.scroller_saved = [ 0, 0 ];
|
|
203
203
|
wo.scroller_isBusy = true;
|
|
204
204
|
|
|
205
|
-
// set scrollbar width
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
// set scrollbar width to one of the following (1) explicitly set scroller_barWidth option,
|
|
206
|
+
// (2) detected scrollbar width or (3) fallback of 15px
|
|
207
|
+
if ( wo.scroller_barWidth !== null ) {
|
|
208
|
+
wo.scroller_barSetWidth = wo.scroller_barWidth;
|
|
209
|
+
} else {
|
|
210
|
+
detectedWidth = tsScroller.getBarWidth();
|
|
211
|
+
wo.scroller_barSetWidth = detectedWidth !== null ? detectedWidth : 15;
|
|
212
|
+
}
|
|
209
213
|
|
|
210
214
|
maxHt = wo.scroller_height || 300;
|
|
211
215
|
|
|
@@ -1,44 +1,61 @@
|
|
|
1
|
-
/*! Widget: sort2Hash - updated
|
|
1
|
+
/*! Widget: sort2Hash (BETA) - updated 11/2/2015 (v2.24.1) */
|
|
2
|
+
/* Requires tablesorter v2.8+ and jQuery 1.7+
|
|
3
|
+
* by Rob Garrison
|
|
4
|
+
*/
|
|
2
5
|
;( function( $ ) {
|
|
3
6
|
'use strict';
|
|
4
7
|
var ts = $.tablesorter || {},
|
|
5
8
|
s2h = {
|
|
6
9
|
init : function( c, wo ) {
|
|
7
|
-
var
|
|
8
|
-
|
|
10
|
+
var filter, temp, page, size,
|
|
11
|
+
table = c.table,
|
|
12
|
+
pager = c.pager,
|
|
13
|
+
hasSaveSort = ts.hasWidget( table, 'saveSort' ),
|
|
14
|
+
sort = s2h.decodeHash( c, wo, 'sort' );
|
|
9
15
|
if ( ( sort && !hasSaveSort ) || ( sort && hasSaveSort && wo.sort2Hash_overrideSaveSort ) ) {
|
|
10
|
-
s2h.
|
|
16
|
+
s2h.convertString2Sort( c, wo, sort );
|
|
11
17
|
}
|
|
12
|
-
|
|
13
|
-
s2h.
|
|
18
|
+
if ( ts.hasWidget( c.table, 'pager' ) ) {
|
|
19
|
+
temp = parseInt( s2h.decodeHash( c, wo, 'page' ), 10 );
|
|
20
|
+
page = pager.page = ( temp < 0 ? 0 : ( temp > pager.totalPages ? pager.totalPages - 1 : temp ) ) + 1;
|
|
21
|
+
size = pager.size = parseInt( s2h.decodeHash( c, wo, 'size' ), 10 );
|
|
22
|
+
}
|
|
23
|
+
if ( ts.hasWidget( table, 'filter' ) ) {
|
|
24
|
+
filter = s2h.decodeHash( c, wo, 'filter' );
|
|
25
|
+
if ( filter ) {
|
|
26
|
+
filter = filter.split( wo.sort2Hash_separator );
|
|
27
|
+
c.$table.one( 'tablesorter-ready', function() {
|
|
28
|
+
setTimeout(function(){
|
|
29
|
+
c.$table.one( 'filterEnd', function(){
|
|
30
|
+
$(this).trigger( 'pageAndSize', [ page, size ] );
|
|
31
|
+
});
|
|
32
|
+
$.tablesorter.setFilters( table, filter, true );
|
|
33
|
+
}, 100 );
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
c.$table.trigger( 'pageAndSize', [ page, size ] );
|
|
38
|
+
}
|
|
39
|
+
c.$table.on( 'sortEnd.sort2hash filterEnd.sort2hash pagerComplete.sort2Hash', function() {
|
|
40
|
+
if ( this.hasInitialized ) {
|
|
41
|
+
s2h.setHash( this.config, this.config.widgetOptions );
|
|
42
|
+
}
|
|
14
43
|
});
|
|
15
44
|
},
|
|
45
|
+
|
|
16
46
|
getTableId : function( c, wo ) {
|
|
17
47
|
// option > table id > table index on page
|
|
18
48
|
return wo.sort2Hash_tableId ||
|
|
19
49
|
c.table.id ||
|
|
20
50
|
'table' + $( 'table' ).index( c.$table );
|
|
21
51
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var value,
|
|
25
|
-
name = s2h.getTableId( c, wo ).replace( /[\[]/, '\\[' ).replace( /[\]]/, '\\]' ),
|
|
26
|
-
sort = ( new RegExp( '[\\#&]' + name + '=([^&]*)' ) ).exec( window.location.hash );
|
|
27
|
-
if ( sort === null ) {
|
|
28
|
-
return '';
|
|
29
|
-
} else {
|
|
30
|
-
value = s2h.processSort( c, wo, sort[ 1 ] );
|
|
31
|
-
if ( clean ) {
|
|
32
|
-
window.location.hash = window.location.hash.replace( '&' + name + '=' + sort[ 1 ], '' );
|
|
33
|
-
return value;
|
|
34
|
-
}
|
|
35
|
-
return sort[ 1 ];
|
|
36
|
-
}
|
|
52
|
+
regexEscape : function( v ) {
|
|
53
|
+
return v.replace( /([\.\^\$\*\+\-\?\(\)\[\]\{\}\\\|])/g, '\\$1');
|
|
37
54
|
},
|
|
38
55
|
// convert 'first%20name,asc,last%20name,desc' into [[0,0], [1,1]]
|
|
39
|
-
|
|
40
|
-
var regex, column, direction, temp,
|
|
41
|
-
arry =
|
|
56
|
+
convertString2Sort : function( c, wo, sortHash ) {
|
|
57
|
+
var regex, column, direction, temp, index, $cell,
|
|
58
|
+
arry = sortHash.split( wo.sort2Hash_separator ),
|
|
42
59
|
indx = 0,
|
|
43
60
|
len = arry.length,
|
|
44
61
|
sort = [];
|
|
@@ -49,14 +66,18 @@
|
|
|
49
66
|
// ignore wo.sort2Hash_useHeaderText setting &
|
|
50
67
|
// just see if column contains a number
|
|
51
68
|
if ( isNaN( temp ) || temp > c.columns ) {
|
|
52
|
-
regex = new RegExp( '(' + column + ')', 'i' );
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
regex = new RegExp( '(' + s2h.regexEscape( column ) + ')', 'i' );
|
|
70
|
+
for ( index = 0; index < c.columns; index++ ) {
|
|
71
|
+
$cell = c.$headerIndexed[ index ];
|
|
72
|
+
if ( regex.test( $cell.attr( wo.sort2Hash_headerTextAttr ) ) ) {
|
|
73
|
+
column = index;
|
|
74
|
+
index = c.columns;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
56
77
|
}
|
|
57
78
|
direction = arry[ indx++ ];
|
|
58
79
|
// ignore unpaired values
|
|
59
|
-
if ( typeof direction !== 'undefined' ) {
|
|
80
|
+
if ( typeof column !== 'undefined' && typeof direction !== 'undefined' ) {
|
|
60
81
|
// convert text to 0, 1
|
|
61
82
|
if ( isNaN( direction ) ) {
|
|
62
83
|
// default to ascending sort
|
|
@@ -71,56 +92,134 @@
|
|
|
71
92
|
},
|
|
72
93
|
|
|
73
94
|
// convert [[0,0],[1,1]] to 'first%20name,asc,last%20name,desc'
|
|
74
|
-
|
|
95
|
+
convertSort2String : function( c, wo ) {
|
|
75
96
|
var index, txt, column, direction,
|
|
76
97
|
sort = [],
|
|
77
98
|
arry = c.sortList || [],
|
|
78
99
|
len = arry.length;
|
|
79
100
|
for ( index = 0; index < len; index++ ) {
|
|
80
101
|
column = arry[ index ][ 0 ];
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if ( typeof wo.sort2Hash_processHeaderText === 'function' ) {
|
|
84
|
-
txt = wo.sort2Hash_processHeaderText( txt, c, column );
|
|
85
|
-
}
|
|
86
|
-
column = txt;
|
|
87
|
-
}
|
|
88
|
-
sort.push( column );
|
|
102
|
+
txt = $.trim( c.$headerIndexed[ column ].attr( wo.sort2Hash_headerTextAttr ) );
|
|
103
|
+
sort.push( txt !== '' ? encodeURIComponent( txt ) : column );
|
|
89
104
|
direction = wo.sort2Hash_directionText[ arry[ index ][ 1 ] ];
|
|
90
105
|
sort.push( direction );
|
|
106
|
+
}
|
|
107
|
+
// join with separator
|
|
108
|
+
return sort.join( wo.sort2Hash_separator );
|
|
109
|
+
},
|
|
91
110
|
|
|
111
|
+
convertFilter2String : function( c, wo ) {
|
|
112
|
+
var index, txt, column, direction,
|
|
113
|
+
sort = [],
|
|
114
|
+
arry = c.sortList || [],
|
|
115
|
+
len = arry.length;
|
|
116
|
+
for ( index = 0; index < len; index++ ) {
|
|
117
|
+
column = arry[ index ][ 0 ];
|
|
118
|
+
txt = $.trim( c.$headerIndexed[ column ].attr( wo.sort2Hash_headerTextAttr ) );
|
|
119
|
+
column = typeof txt !== 'undefined' ? encodeURIComponent( txt ) : column;
|
|
120
|
+
sort.push( column );
|
|
121
|
+
direction = wo.sort2Hash_directionText[ arry[ index ][ 1 ] ];
|
|
122
|
+
sort.push( direction );
|
|
92
123
|
}
|
|
93
124
|
// join with separator
|
|
94
125
|
return sort.join( wo.sort2Hash_separator );
|
|
95
126
|
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
127
|
+
|
|
128
|
+
encodeHash : function( c, wo, component, value, rawValue ) {
|
|
129
|
+
var result = false,
|
|
130
|
+
tableId = s2h.getTableId( c, wo );
|
|
131
|
+
if ( typeof wo.sort2Hash_encodeHash === 'function' ) {
|
|
132
|
+
result = wo.sort2Hash_encodeHash( c, tableId, component, value, rawValue || value );
|
|
133
|
+
}
|
|
134
|
+
if ( result === false ) {
|
|
135
|
+
result = '&' + component + '[' + tableId + ']=' + value;
|
|
136
|
+
}
|
|
137
|
+
return result;
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
decodeHash : function( c, wo, component ) {
|
|
141
|
+
var regex,
|
|
142
|
+
result = false,
|
|
143
|
+
tableId = s2h.getTableId( c, wo );
|
|
144
|
+
if ( typeof wo.sort2Hash_decodeHash === 'function' ) {
|
|
145
|
+
result = wo.sort2Hash_decodeHash( c, tableId, component );
|
|
146
|
+
}
|
|
147
|
+
if ( result === false ) {
|
|
148
|
+
regex = new RegExp( '[\\#&]' + component + '\\[' + s2h.regexEscape( tableId ) + '\\]=([^&]*)' ),
|
|
149
|
+
/*jshint -W030 */
|
|
150
|
+
result = regex.exec( window.location.hash );
|
|
103
151
|
}
|
|
152
|
+
return result ? decodeURIComponent( result[ 1 ] ) : '';
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
cleanHash : function( c, wo, component, hash ) {
|
|
156
|
+
var index, len, parts, regex,
|
|
157
|
+
result = false,
|
|
158
|
+
tableId = s2h.getTableId( c, wo );
|
|
159
|
+
if ( typeof wo.sort2Hash_cleanHash === 'function' ) {
|
|
160
|
+
result = wo.sort2Hash_cleanHash( c, tableId, component, hash );
|
|
161
|
+
}
|
|
162
|
+
if ( result === false ) {
|
|
163
|
+
result = [];
|
|
164
|
+
parts = ( hash || '' ).slice(1).split( '&' );
|
|
165
|
+
len = parts.length;
|
|
166
|
+
regex = new RegExp( component + '\\[' + s2h.regexEscape( tableId ) + '\\]=([^&]*)' );
|
|
167
|
+
for ( index = 0; index < len; index++ ) {
|
|
168
|
+
if ( !regex.test( parts[ index ] ) ) {
|
|
169
|
+
result.push( parts[ index ] );
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return result.length ? '#' + result.join( '&' ) : '';
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
setHash : function( c, wo ) {
|
|
177
|
+
var str = '',
|
|
178
|
+
hash = window.location.hash,
|
|
179
|
+
hasPager = ts.hasWidget( c.table, 'pager' ),
|
|
180
|
+
hasFilter = ts.hasWidget( c.table, 'filter' ),
|
|
181
|
+
sortList = s2h.convertSort2String( c, wo ),
|
|
182
|
+
filters = ( hasFilter && c.lastSearch.join('') !== '' ? c.lastSearch : [] ),
|
|
183
|
+
filtersStr = encodeURIComponent( filters.join( c.widgetOptions.sort2Hash_separator ) ),
|
|
184
|
+
components = {
|
|
185
|
+
'sort' : sortList ? s2h.encodeHash( c, wo, 'sort', sortList, c.sortList ) : '',
|
|
186
|
+
'page' : hasPager ? s2h.encodeHash( c, wo, 'page', c.pager.page + 1 ) : '',
|
|
187
|
+
'size' : hasPager ? s2h.encodeHash( c, wo, 'size', c.pager.size ) : '',
|
|
188
|
+
'filter' : filtersStr ? s2h.encodeHash( c, wo, 'filter', filtersStr, filters ) : ''
|
|
189
|
+
};
|
|
190
|
+
// remove old hash
|
|
191
|
+
$.each( components, function( component, value ) {
|
|
192
|
+
hash = s2h.cleanHash( c, wo, component, hash );
|
|
193
|
+
str += value;
|
|
194
|
+
});
|
|
195
|
+
// add updated hash
|
|
196
|
+
window.location.hash = ( ( window.location.hash || '' ).replace( '#', '' ).length ? hash : wo.sort2Hash_hash ) + str;
|
|
104
197
|
}
|
|
105
198
|
};
|
|
106
199
|
|
|
107
200
|
ts.addWidget({
|
|
108
201
|
id: 'sort2Hash',
|
|
109
|
-
priority:
|
|
202
|
+
priority: 60, // after saveSort & pager
|
|
110
203
|
options: {
|
|
111
204
|
sort2Hash_hash : '#', // hash prefix
|
|
112
205
|
sort2Hash_separator : '-', // don't '#' or '=' here
|
|
113
|
-
|
|
114
|
-
sort2Hash_useHeaderText : false, // use column header text (true) or zero-based column index
|
|
115
|
-
sort2Hash_processHeaderText : null, // function( text, config, columnIndex ) {},
|
|
206
|
+
sort2Hash_headerTextAttr : 'data-header', // data attribute containing alternate header text
|
|
116
207
|
sort2Hash_directionText : [ 0, 1 ], // [ 'asc', 'desc' ],
|
|
117
208
|
sort2Hash_overrideSaveSort : false // if true, override saveSort widget if saved sort available
|
|
209
|
+
|
|
210
|
+
// Options below commented out for improved compression
|
|
211
|
+
// ******************
|
|
212
|
+
// sort2Hash_tableId : null, // this option > table ID > table index on page,
|
|
213
|
+
// custom hash processing functions
|
|
214
|
+
// sort2Hash_encodeHash : null,
|
|
215
|
+
// sort2Hash_decodeHash : null,
|
|
216
|
+
// sort2Hash_cleanHash : null
|
|
118
217
|
},
|
|
119
218
|
init: function(table, thisWidget, c, wo) {
|
|
120
219
|
s2h.init( c, wo );
|
|
121
220
|
},
|
|
122
221
|
remove: function(table, c) {
|
|
123
|
-
c.$table.off( '
|
|
222
|
+
c.$table.off( '.sort2hash' );
|
|
124
223
|
}
|
|
125
224
|
});
|
|
126
225
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! tablesorter tbody sorting widget (BETA) -
|
|
1
|
+
/*! tablesorter tbody sorting widget (BETA) - 10/31/2015 (v2.24.0)
|
|
2
2
|
* Requires tablesorter v2.22.2+ and jQuery 1.4+
|
|
3
3
|
* by Rob Garrison
|
|
4
4
|
*/
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
.bind( 'updateComplete' + namespace, function() {
|
|
38
38
|
// find parsers for each column
|
|
39
39
|
ts.sortTbodies.setTbodies( c, wo );
|
|
40
|
-
|
|
40
|
+
ts.updateCache( c, null, c.$tbodies );
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
// detect parsers - in case the table contains only info-only tbodies
|
|
44
44
|
if ( $.isEmptyObject( c.parsers ) || c.$tbodies.length !== $tbodies.length ) {
|
|
45
45
|
ts.sortTbodies.setTbodies( c, wo );
|
|
46
|
-
|
|
46
|
+
ts.updateCache( c, null, c.$tbodies );
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
// find colMax; this only matter for numeric columns
|
|
@@ -116,10 +116,10 @@
|
|
|
116
116
|
colMax = c.$headerIndexed[ col ].attr( 'data-ts-col-max-value' ) ||
|
|
117
117
|
1.79E+308; // close to Number.MAX_VALUE
|
|
118
118
|
// sort strings in numerical columns
|
|
119
|
-
if ( typeof (
|
|
120
|
-
num = ( dir ? 1 : -1 ) * (
|
|
119
|
+
if ( typeof ( ts.string[ c.strings[ col ] ] ) === 'boolean' ) {
|
|
120
|
+
num = ( dir ? 1 : -1 ) * ( ts.string[ c.strings[ col ] ] ? -1 : 1 );
|
|
121
121
|
} else {
|
|
122
|
-
num = ( c.strings[ col ] ) ?
|
|
122
|
+
num = ( c.strings[ col ] ) ? ts.string[ c.strings[ col ] ] || 0 : 0;
|
|
123
123
|
}
|
|
124
124
|
// fall back to built-in numeric sort
|
|
125
125
|
// var sort = $.tablesorter['sort' + s](a, b, dir, colMax, table);
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
sort = cts[ col ]( x, y, dir, col, table );
|
|
139
139
|
} else {
|
|
140
140
|
// fall back to natural sort
|
|
141
|
-
sort = ts[ 'sortNatural' + ( dir ? 'Asc' : 'Desc' ) ]( colA, colB, col,
|
|
141
|
+
sort = ts[ 'sortNatural' + ( dir ? 'Asc' : 'Desc' ) ]( colA, colB, col, c );
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
if ( sort ) { return sort; }
|