jquery-tablesorter 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +1 -1
- data/lib/jquery-tablesorter/version.rb +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +46 -24
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +66 -56
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +12 -7
- 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: b894fbd38fd0b3ea6b2606395da5b3d9610e0164
|
4
|
+
data.tar.gz: 3f45a27f4f427e5f4596885a560587adae9a9a86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c8e1f14359f525dcaf865a6bcabf56589faa509ecf5c4d36a9fe9ef9ff79be759c123f03c9141604fdb825451f28b31a4fc40e2548dde68fba46bd3bc77bbc2
|
7
|
+
data.tar.gz: ed439ddc82f74905ca27944b83cf35d5d89e3838a3b6b13b0003aa9bc334edaaf7f4ce34dff9fb8d0a8288102604c8a5d51d18bc4552dca75278a629a35ea329
|
data/README.markdown
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.
|
7
|
+
Current tablesorter version: 2.12 (10/18/2013), [documentation]
|
8
8
|
|
9
9
|
Any issue associate with the js/css files, please report to [Mottie's fork].
|
10
10
|
|
@@ -1,9 +1,8 @@
|
|
1
1
|
/*!
|
2
2
|
* tablesorter pager plugin
|
3
|
-
* updated 10/
|
3
|
+
* updated 10/18/2013
|
4
4
|
*/
|
5
5
|
/*jshint browser:true, jquery:true, unused:false */
|
6
|
-
/*global toString:true */
|
7
6
|
;(function($) {
|
8
7
|
"use strict";
|
9
8
|
/*jshint supernew:true */
|
@@ -87,7 +86,12 @@
|
|
87
86
|
totalRows: 0,
|
88
87
|
totalPages: 0,
|
89
88
|
filteredRows: 0,
|
90
|
-
filteredPages: 0
|
89
|
+
filteredPages: 0,
|
90
|
+
currentFilters: [],
|
91
|
+
startRow: 0,
|
92
|
+
endRow: 0,
|
93
|
+
$size: null,
|
94
|
+
last: {}
|
91
95
|
|
92
96
|
};
|
93
97
|
|
@@ -110,10 +114,11 @@
|
|
110
114
|
var i, pg, s, out,
|
111
115
|
c = table.config,
|
112
116
|
f = c.$table.hasClass('hasFilters') && !p.ajaxUrl,
|
113
|
-
t = (c.widgetOptions && c.widgetOptions.filter_filteredRow || 'filtered') + ',' + c.selectorRemove
|
114
|
-
|
117
|
+
t = (c.widgetOptions && c.widgetOptions.filter_filteredRow || 'filtered') + ',' + c.selectorRemove,
|
118
|
+
sz = p.size || 10; // don't allow dividing by zero
|
119
|
+
p.totalPages = Math.ceil( p.totalRows / sz ); // needed for "pageSize" method
|
115
120
|
p.filteredRows = (f) ? c.$tbodies.eq(0).children('tr:not(.' + t + ')').length : p.totalRows;
|
116
|
-
p.filteredPages = (f) ? Math.ceil( p.filteredRows /
|
121
|
+
p.filteredPages = (f) ? Math.ceil( p.filteredRows / sz ) || 1 : p.totalPages;
|
117
122
|
if ( Math.min( p.totalPages, p.filteredPages ) >= 0 ) {
|
118
123
|
t = (p.size * p.page > p.filteredRows);
|
119
124
|
p.startRow = (t) ? 1 : (p.filteredRows === 0 ? 0 : p.size * p.page + 1);
|
@@ -121,7 +126,7 @@
|
|
121
126
|
p.endRow = Math.min( p.filteredRows, p.totalRows, p.size * ( p.page + 1 ) );
|
122
127
|
out = p.$container.find(p.cssPageDisplay);
|
123
128
|
// form the output string (can now get a new output string from the server)
|
124
|
-
s = ( p.ajaxData && p.ajaxData.
|
129
|
+
s = ( p.ajaxData && p.ajaxData.output ? p.ajaxData.output || p.output : p.output )
|
125
130
|
// {page} = one-based index; {page+#} = zero based index +/- value
|
126
131
|
.replace(/\{page([\-+]\d+)?\}/gi, function(m,n){
|
127
132
|
return p.page + (n ? parseInt(n, 10) : 1);
|
@@ -242,7 +247,7 @@
|
|
242
247
|
c.$tbodies.eq(0).empty();
|
243
248
|
} else {
|
244
249
|
// process ajax object
|
245
|
-
if (
|
250
|
+
if (!$.isArray(result)) {
|
246
251
|
p.ajaxData = result;
|
247
252
|
p.totalRows = result.total;
|
248
253
|
th = result.headers;
|
@@ -304,7 +309,7 @@
|
|
304
309
|
if (c.showProcessing) {
|
305
310
|
ts.isProcessing(table); // remove loading icon
|
306
311
|
}
|
307
|
-
p.totalPages = Math.ceil( p.totalRows / p.size );
|
312
|
+
p.totalPages = Math.ceil( p.totalRows / ( p.size || 10 ) );
|
308
313
|
updatePageDisplay(table, p);
|
309
314
|
fixHeight(table, p);
|
310
315
|
if (p.initialized) {
|
@@ -380,13 +385,18 @@
|
|
380
385
|
},
|
381
386
|
|
382
387
|
renderTable = function(table, rows, p) {
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
e = ( s + p.size );
|
388
|
+
var i, $tb,
|
389
|
+
l = rows && rows.length || 0, // rows may be undefined
|
390
|
+
s = ( p.page * p.size ),
|
391
|
+
e = ( s + p.size );
|
388
392
|
if ( l < 1 ) { return; } // empty table, abort!
|
393
|
+
if ( p.page >= p.totalPages ) {
|
394
|
+
// lets not render the table more than once
|
395
|
+
moveToLastPage(table, p);
|
396
|
+
}
|
397
|
+
p.isDisabled = false; // needed because sorting will change the page and re-enable the pager
|
389
398
|
if (p.initialized) { $(table).trigger('pagerChange', p); }
|
399
|
+
|
390
400
|
if ( !p.removeRows ) {
|
391
401
|
hideRows(table, p);
|
392
402
|
} else {
|
@@ -400,9 +410,7 @@
|
|
400
410
|
}
|
401
411
|
ts.processTbody(table, $tb, false);
|
402
412
|
}
|
403
|
-
|
404
|
-
moveToLastPage(table, p);
|
405
|
-
}
|
413
|
+
|
406
414
|
updatePageDisplay(table, p);
|
407
415
|
if ( !p.isDisabled ) { fixHeight(table, p); }
|
408
416
|
$(table).trigger('applyWidgets');
|
@@ -418,7 +426,7 @@
|
|
418
426
|
p.page = 0;
|
419
427
|
p.size = p.totalRows;
|
420
428
|
p.totalPages = 1;
|
421
|
-
$(table).find('tr.pagerSavedHeightSpacer').remove();
|
429
|
+
$(table).addClass('pagerDisabled').find('tr.pagerSavedHeightSpacer').remove();
|
422
430
|
renderTable(table, table.config.rowsCopy, p);
|
423
431
|
}
|
424
432
|
// disable size selector
|
@@ -429,9 +437,18 @@
|
|
429
437
|
|
430
438
|
moveToPage = function(table, p, flag) {
|
431
439
|
if ( p.isDisabled ) { return; }
|
432
|
-
var
|
440
|
+
var l = p.last,
|
441
|
+
pg = Math.min( p.totalPages, p.filteredPages );
|
433
442
|
if ( p.page < 0 ) { p.page = 0; }
|
434
443
|
if ( p.page > ( pg - 1 ) && pg !== 0 ) { p.page = pg - 1; }
|
444
|
+
// don't allow rendering multiple times on the same page/size/totalpages/filters
|
445
|
+
if (l.page === p.page && l.size === p.size && l.total === p.totalPages && l.filters === p.currentFilters ) { return; }
|
446
|
+
p.last = {
|
447
|
+
page : p.page,
|
448
|
+
size : p.size,
|
449
|
+
totalPages : p.totalPages,
|
450
|
+
currentFilters : p.currentFilters
|
451
|
+
};
|
435
452
|
if (p.ajax) {
|
436
453
|
getAjax(table, p);
|
437
454
|
} else if (!p.ajax) {
|
@@ -449,7 +466,7 @@
|
|
449
466
|
p.$size.val(size);
|
450
467
|
$.data(table, 'pagerLastPage', p.page);
|
451
468
|
$.data(table, 'pagerLastSize', p.size);
|
452
|
-
p.totalPages = Math.ceil( p.totalRows / p.size );
|
469
|
+
p.totalPages = Math.ceil( p.totalRows / ( p.size || 10 ) );
|
453
470
|
moveToPage(table, p);
|
454
471
|
},
|
455
472
|
|
@@ -483,7 +500,11 @@
|
|
483
500
|
showAllRows(table, p);
|
484
501
|
p.$container.hide(); // hide pager
|
485
502
|
table.config.appender = null; // remove pager appender function
|
503
|
+
p.initialized = false;
|
486
504
|
$(table).unbind('destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager');
|
505
|
+
if (ts.storage) {
|
506
|
+
ts.storage(table, 'tablesorter-pager', '');
|
507
|
+
}
|
487
508
|
},
|
488
509
|
|
489
510
|
enablePager = function(table, p, triggered){
|
@@ -493,7 +514,7 @@
|
|
493
514
|
p.page = $.data(table, 'pagerLastPage') || p.page || 0;
|
494
515
|
p.size = $.data(table, 'pagerLastSize') || parseInt(pg.find('option[selected]').val(), 10) || p.size;
|
495
516
|
pg.val(p.size); // set page size
|
496
|
-
p.totalPages = Math.ceil( Math.min( p.totalPages, p.filteredPages ) / p.size);
|
517
|
+
p.totalPages = Math.ceil( Math.min( p.totalPages, p.filteredPages ) / ( p.size || 10 ) );
|
497
518
|
if ( triggered ) {
|
498
519
|
$(table).trigger('update');
|
499
520
|
setPageSize(table, p.size, p);
|
@@ -508,7 +529,7 @@
|
|
508
529
|
table.config.rowsCopy = rows;
|
509
530
|
p.totalRows = rows.length;
|
510
531
|
p.size = $.data(table, 'pagerLastSize') || p.size;
|
511
|
-
p.totalPages = Math.ceil(p.totalRows / p.size);
|
532
|
+
p.totalPages = Math.ceil( p.totalRows / ( p.size || 10 ) );
|
512
533
|
renderTable(table, rows, p);
|
513
534
|
}
|
514
535
|
};
|
@@ -528,9 +549,9 @@
|
|
528
549
|
c.appender = $this.appender;
|
529
550
|
|
530
551
|
if (p.savePages && ts.storage) {
|
531
|
-
t = ts.storage(table, 'tablesorter-pager');
|
552
|
+
t = ts.storage(table, 'tablesorter-pager') || {}; // fixes #387
|
532
553
|
p.page = isNaN(t.page) ? p.page : t.page;
|
533
|
-
p.size = isNaN(t.size) ? p.size : t.size;
|
554
|
+
p.size = ( isNaN(t.size) ? p.size : t.size ) || 10;
|
534
555
|
}
|
535
556
|
|
536
557
|
$t
|
@@ -610,6 +631,7 @@
|
|
610
631
|
.bind('change', function(){
|
611
632
|
p.page = $(this).val() - 1;
|
612
633
|
moveToPage(table, p);
|
634
|
+
updatePageDisplay(table, p, false);
|
613
635
|
});
|
614
636
|
}
|
615
637
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**!
|
2
|
-
* TableSorter 2.
|
2
|
+
* TableSorter 2.12.0 - 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.
|
27
|
+
ts.version = "2.12.0";
|
28
28
|
|
29
29
|
ts.parsers = [];
|
30
30
|
ts.widgets = [];
|
@@ -63,7 +63,8 @@
|
|
63
63
|
emptyTo : 'bottom', // sort empty cell to bottom, top, none, zero
|
64
64
|
stringTo : 'max', // sort strings in numerical column as max, min, top, bottom, zero
|
65
65
|
textExtraction : 'simple', // text extraction method/function - function(node, table, cellIndex){}
|
66
|
-
textSorter : null, //
|
66
|
+
textSorter : null, // choose overall or specific column sorter function(a, b, direction, table, columnIndex) [alt: ts.sortText]
|
67
|
+
numberSorter : null, // choose overall numeric sorter function(a, b, direction, maxColumnValue)
|
67
68
|
|
68
69
|
// *** widget options
|
69
70
|
widgets: [], // method to add widgets, e.g. widgets: ['zebra']
|
@@ -388,7 +389,8 @@
|
|
388
389
|
}
|
389
390
|
}
|
390
391
|
}
|
391
|
-
|
392
|
+
// may not be accurate if # header columns !== # tbody columns
|
393
|
+
t.config.columns = cols + 1; // add one because it's a zero-based index
|
392
394
|
return lookup;
|
393
395
|
}
|
394
396
|
|
@@ -409,14 +411,14 @@
|
|
409
411
|
c.$headers = $(table).find(c.selectorHeaders).each(function(index) {
|
410
412
|
$t = $(this);
|
411
413
|
ch = c.headers[index];
|
412
|
-
c.headerContent[index] = this.
|
414
|
+
c.headerContent[index] = $(this).html(); // save original header content
|
413
415
|
// set up header template
|
414
|
-
t = c.headerTemplate.replace(/\{content\}/g, this.
|
416
|
+
t = c.headerTemplate.replace(/\{content\}/g, $(this).html()).replace(/\{icon\}/g, i);
|
415
417
|
if (c.onRenderTemplate) {
|
416
418
|
h = c.onRenderTemplate.apply($t, [index, t]);
|
417
419
|
if (h && typeof h === 'string') { t = h; } // only change t if something is returned
|
418
420
|
}
|
419
|
-
this.
|
421
|
+
$(this).html('<div class="tablesorter-header-inner">' + t + '</div>'); // faster than wrapInner
|
420
422
|
|
421
423
|
if (c.onRenderHeader) { c.onRenderHeader.apply($t, [index]); }
|
422
424
|
|
@@ -629,41 +631,71 @@
|
|
629
631
|
|
630
632
|
// sort multiple columns
|
631
633
|
function multisort(table) { /*jshint loopfunc:true */
|
632
|
-
var
|
633
|
-
|
634
|
-
|
635
|
-
|
634
|
+
var i, k, e, num, col, colMax, cache, lc,
|
635
|
+
order, orgOrderCol, sortTime, sort, x, y,
|
636
|
+
dir = 0,
|
637
|
+
c = table.config,
|
638
|
+
cts = c.textSorter || '',
|
639
|
+
sortList = c.sortList,
|
640
|
+
l = sortList.length,
|
641
|
+
bl = table.tBodies.length;
|
642
|
+
if (c.serverSideSorting || isEmptyObject(c.cache)) { // empty table - fixes #206/#346
|
636
643
|
return;
|
637
644
|
}
|
638
|
-
if (
|
645
|
+
if (c.debug) { sortTime = new Date(); }
|
639
646
|
for (k = 0; k < bl; k++) {
|
640
|
-
colMax =
|
641
|
-
cache =
|
647
|
+
colMax = c.cache[k].colMax;
|
648
|
+
cache = c.cache[k].normalized;
|
642
649
|
lc = cache.length;
|
643
650
|
orgOrderCol = (cache && cache[0]) ? cache[0].length - 1 : 0;
|
644
651
|
cache.sort(function(a, b) {
|
645
652
|
// cache is undefined here in IE, so don't use it!
|
646
653
|
for (i = 0; i < l; i++) {
|
647
|
-
|
654
|
+
col = sortList[i][0];
|
648
655
|
order = sortList[i][1];
|
656
|
+
// sort direction, true = asc, false = desc
|
657
|
+
dir = order === 0;
|
658
|
+
|
659
|
+
// set a & b depending on sort direction
|
660
|
+
x = dir ? a : b;
|
661
|
+
y = dir ? b : a;
|
662
|
+
|
663
|
+
// determine how to sort empty cells
|
664
|
+
e = c.string[ (c.empties[col] || c.emptyTo ) ];
|
665
|
+
if (x[col] === '' && e !== 0) { return ((typeof(e) === 'boolean') ? (e ? -1 : 1) : (e || 1)) * (dir ? 1 : -1); }
|
666
|
+
if (y[col] === '' && e !== 0) { return ((typeof(e) === 'boolean') ? (e ? 1 : -1) : (-e || -1)) * (dir ? 1 : -1); }
|
667
|
+
|
649
668
|
// fallback to natural sort since it is more robust
|
650
|
-
|
651
|
-
|
652
|
-
if (/Numeric/.test(s) && tc.strings[c]) {
|
669
|
+
num = /n/i.test(getCachedSortType(c.parsers, col));
|
670
|
+
if (num && c.strings[col]) {
|
653
671
|
// sort strings in numerical columns
|
654
|
-
if (typeof (
|
655
|
-
|
672
|
+
if (typeof (c.string[c.strings[col]]) === 'boolean') {
|
673
|
+
num = (dir ? 1 : -1) * (c.string[c.strings[col]] ? -1 : 1);
|
674
|
+
} else {
|
675
|
+
num = (c.strings[col]) ? c.string[c.strings[col]] || 0 : 0;
|
676
|
+
}
|
677
|
+
// fall back to built-in numeric sort
|
678
|
+
// var sort = $.tablesorter["sort" + s](table, a[c], b[c], c, colMax[c], dir);
|
679
|
+
sort = c.numberSorter ? c.numberSorter(x[col], y[col], dir, colMax[col], table) : ts.sortNumeric(x[col], y[col], num, colMax[col]);
|
680
|
+
} else {
|
681
|
+
// text sort function
|
682
|
+
if (typeof(cts) === 'function') {
|
683
|
+
// custom OVERALL text sorter
|
684
|
+
sort = cts(x[col], y[col], dir, col, table);
|
685
|
+
} else if (typeof(cts) === 'object' && cts.hasOwnProperty(col)) {
|
686
|
+
// custom text sorter for a SPECIFIC COLUMN
|
687
|
+
sort = cts[col](x[col], y[col], dir, col, table);
|
656
688
|
} else {
|
657
|
-
|
689
|
+
// fall back to natural sort
|
690
|
+
sort = ts.sortNatural(x[col], y[col]);
|
658
691
|
}
|
659
692
|
}
|
660
|
-
var sort = $.tablesorter["sort" + s](table, a[c], b[c], c, colMax[c], dir);
|
661
693
|
if (sort) { return sort; }
|
662
694
|
}
|
663
695
|
return a[orgOrderCol] - b[orgOrderCol];
|
664
696
|
});
|
665
697
|
}
|
666
|
-
if (
|
698
|
+
if (c.debug) { benchmark("Sorting on " + sortList.toString() + " and dir " + order + " time", sortTime); }
|
667
699
|
}
|
668
700
|
|
669
701
|
function resortComplete($table, callback){
|
@@ -1030,15 +1062,10 @@
|
|
1030
1062
|
};
|
1031
1063
|
|
1032
1064
|
// Natural sort - https://github.com/overset/javascript-natural-sort (date sorting removed)
|
1033
|
-
ts.
|
1065
|
+
ts.sortNatural = function(a, b) {
|
1034
1066
|
if (a === b) { return 0; }
|
1035
|
-
var
|
1036
|
-
r = ts.regex
|
1037
|
-
// sorting empty cells
|
1038
|
-
if (a === '' && e !== 0) { return typeof e === 'boolean' ? (e ? -1 : 1) : -e || -1; }
|
1039
|
-
if (b === '' && e !== 0) { return typeof e === 'boolean' ? (e ? 1 : -1) : e || 1; }
|
1040
|
-
// custom sorter
|
1041
|
-
if (typeof c.textSorter === 'function') { return c.textSorter(a, b, table, col); }
|
1067
|
+
var xN, xD, yN, yD, xF, yF, i, mx,
|
1068
|
+
r = ts.regex;
|
1042
1069
|
// numeric or hex detection
|
1043
1070
|
yD = parseInt(b.match(r.hex), 16);
|
1044
1071
|
// first try and sort Hex codes
|
@@ -1069,19 +1096,15 @@
|
|
1069
1096
|
return 0;
|
1070
1097
|
};
|
1071
1098
|
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
if (a === '' && e !== 0) { return typeof e === 'boolean' ? (e ? -1 : 1) : e || 1; }
|
1076
|
-
if (b === '' && e !== 0) { return typeof e === 'boolean' ? (e ? 1 : -1) : -e || -1; }
|
1077
|
-
if (typeof c.textSorter === 'function') { return c.textSorter(b, a, table, col); }
|
1078
|
-
return ts.sortText(table, b, a);
|
1099
|
+
// basic alphabetical sort
|
1100
|
+
ts.sortText = function(a, b) {
|
1101
|
+
return a > b ? 1 : (a < b ? -1 : 0);
|
1079
1102
|
};
|
1080
1103
|
|
1081
1104
|
// return text string value by adding up ascii value
|
1082
1105
|
// so the text is somewhat sorted when using a digital sort
|
1083
1106
|
// this is NOT an alphanumeric sort
|
1084
|
-
ts.getTextValue = function(a,
|
1107
|
+
ts.getTextValue = function(a, d, mx) {
|
1085
1108
|
if (mx) {
|
1086
1109
|
// make sure the text value is greater than the max numerical value (mx)
|
1087
1110
|
var i, l = a ? a.length : 0, n = mx + d;
|
@@ -1093,26 +1116,13 @@
|
|
1093
1116
|
return 0;
|
1094
1117
|
};
|
1095
1118
|
|
1096
|
-
ts.sortNumeric = function(
|
1119
|
+
ts.sortNumeric = function(a, b, dir, mx) {
|
1097
1120
|
if (a === b) { return 0; }
|
1098
|
-
|
1099
|
-
if (
|
1100
|
-
if (b === '' && e !== 0) { return typeof e === 'boolean' ? (e ? 1 : -1) : e || 1; }
|
1101
|
-
if (isNaN(a)) { a = ts.getTextValue(a, mx, d); }
|
1102
|
-
if (isNaN(b)) { b = ts.getTextValue(b, mx, d); }
|
1121
|
+
if (isNaN(a)) { a = ts.getTextValue(a, dir, mx); }
|
1122
|
+
if (isNaN(b)) { b = ts.getTextValue(b, dir, mx); }
|
1103
1123
|
return a - b;
|
1104
1124
|
};
|
1105
1125
|
|
1106
|
-
ts.sortNumericDesc = function(table, a, b, col, mx, d) {
|
1107
|
-
if (a === b) { return 0; }
|
1108
|
-
var c = table.config, e = c.string[ (c.empties[col] || c.emptyTo ) ];
|
1109
|
-
if (a === '' && e !== 0) { return typeof e === 'boolean' ? (e ? -1 : 1) : e || 1; }
|
1110
|
-
if (b === '' && e !== 0) { return typeof e === 'boolean' ? (e ? 1 : -1) : -e || -1; }
|
1111
|
-
if (isNaN(a)) { a = ts.getTextValue(a, mx, d); }
|
1112
|
-
if (isNaN(b)) { b = ts.getTextValue(b, mx, d); }
|
1113
|
-
return b - a;
|
1114
|
-
};
|
1115
|
-
|
1116
1126
|
// used when replacing accented characters during sorting
|
1117
1127
|
ts.characterEquivalents = {
|
1118
1128
|
"a" : "\u00e1\u00e0\u00e2\u00e3\u00e4\u0105\u00e5", // áàâãäąå
|
@@ -1204,7 +1214,7 @@
|
|
1204
1214
|
var c = table.config,
|
1205
1215
|
wo = c.widgetOptions,
|
1206
1216
|
widgets = [],
|
1207
|
-
time,
|
1217
|
+
time, w, wd;
|
1208
1218
|
if (c.debug) { time = new Date(); }
|
1209
1219
|
if (c.widgets.length) {
|
1210
1220
|
// ensure unique widget ids
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! tableSorter 2.8+ widgets - updated
|
1
|
+
/*! tableSorter 2.8+ widgets - updated 10/18/2013
|
2
2
|
*
|
3
3
|
* Column Styles
|
4
4
|
* Column Filters
|
@@ -66,10 +66,11 @@ ts.themes = {
|
|
66
66
|
val = (v && v.hasOwnProperty('mywidget')) ? v.mywidget : '';
|
67
67
|
alert(val); // "data1" if saved, or "" if not
|
68
68
|
*/
|
69
|
-
ts.storage = function(table, key, val){
|
69
|
+
ts.storage = function(table, key, val, options){
|
70
70
|
var d, k, ls = false, v = {},
|
71
|
-
|
72
|
-
|
71
|
+
c = table.config,
|
72
|
+
id = options && options.id || $(table).attr(options && options.group || 'data-table-group') || table.id || $('.tablesorter').index( $(table) ),
|
73
|
+
url = options && options.url || $(table).attr(options && options.page || 'data-table-page') || c && c.fixedUrl || window.location.pathname;
|
73
74
|
// https://gist.github.com/paulirish/5558557
|
74
75
|
if ("localStorage" in window) {
|
75
76
|
try {
|
@@ -355,7 +356,9 @@ ts.addWidget({
|
|
355
356
|
}
|
356
357
|
},
|
357
358
|
format: function(table, c, wo){
|
358
|
-
if (c
|
359
|
+
if (c.$table.hasClass('hasFilters')) { return; }
|
360
|
+
// allow filter widget to work if it is being used
|
361
|
+
if (c.parsers || !c.parsers && wo.filter_serversideFiltering){
|
359
362
|
var i, j, k, l, val, ff, x, xi, st, sel, str,
|
360
363
|
ft, ft2, $th, rg, s, t, dis, col,
|
361
364
|
fmt = ts.formatFloat,
|
@@ -363,7 +366,8 @@ ts.addWidget({
|
|
363
366
|
$ths = c.$headers,
|
364
367
|
$t = c.$table.addClass('hasFilters'),
|
365
368
|
b = c.$tbodies,
|
366
|
-
|
369
|
+
// c.columns defined in computeThIndexes()
|
370
|
+
cols = c.columns || c.$headers.filter('th').length,
|
367
371
|
parsed, time, timer,
|
368
372
|
|
369
373
|
// dig fer gold
|
@@ -572,7 +576,7 @@ ts.addWidget({
|
|
572
576
|
arry = $.grep(arry, function(v, k){
|
573
577
|
return $.inArray(v, arry) === k;
|
574
578
|
});
|
575
|
-
arry = (ts.
|
579
|
+
arry = (ts.sortNatural) ? arry.sort(function(a, b){ return ts.sortNatural(a, b); }) : arry.sort(true);
|
576
580
|
|
577
581
|
// Get curent filter value
|
578
582
|
currentVal = $t.find('thead').find('select.tablesorter-filter[data-column="' + i + '"]').val();
|
@@ -615,6 +619,7 @@ ts.addWidget({
|
|
615
619
|
wo.filter_regex.child = new RegExp(c.cssChildRow);
|
616
620
|
wo.filter_regex.filtered = new RegExp(wo.filter_filteredRow);
|
617
621
|
// don't build filter row if columnFilters is false or all columns are set to "filter-false" - issue #156
|
622
|
+
|
618
623
|
if (wo.filter_columnFilters !== false && $ths.filter('.filter-false').length !== $ths.length){
|
619
624
|
// build filter row
|
620
625
|
t = '<tr class="tablesorter-filter-row">';
|
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.
|
4
|
+
version: 1.7.0
|
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: 2013-10-
|
12
|
+
date: 2013-10-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|