jquery-tablesorter 1.12.3 → 1.12.4
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 +8 -4
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +7 -2
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +91 -59
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +9 -5
- 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: 5b3086b10974536212d92994bb1a07c53305fb0d
|
4
|
+
data.tar.gz: a8a53ba9dda00df5fda43382fd4996c4ef50d5cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54887be0d4abdfba84a5c6c01b724a34756e95618369b6078a51dbaef6afa2edafb3ee5ed5f43cea7bf67941b732db7238c2f33f62a24a8cc18c679dd7ec52ac
|
7
|
+
data.tar.gz: a51d74004a0ea5f3aa2fb7fe710d2f23665a5b846f0749eb3e36b232b696cbaaae150e31b8d5773d735fe2d3d56c787fda1f18328bf883bf5f9a1a82d2fe7101
|
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.17.
|
7
|
+
Current tablesorter version: 2.17.4 (7/4/2014), [documentation]
|
8
8
|
|
9
9
|
Any issue associated with the js/css files, please report to [Mottie's fork].
|
10
10
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
2
|
* tablesorter pager plugin
|
3
|
-
* updated
|
3
|
+
* updated 7/4/2014 (v2.17.4)
|
4
4
|
*/
|
5
5
|
/*jshint browser:true, jquery:true, unused:false */
|
6
6
|
;(function($) {
|
@@ -146,6 +146,8 @@
|
|
146
146
|
} else if (!f) {
|
147
147
|
p.filteredRows = p.totalRows;
|
148
148
|
}
|
149
|
+
c.totalRows = p.totalRows;
|
150
|
+
c.filteredRows = p.filteredRows;
|
149
151
|
p.filteredPages = Math.ceil( p.filteredRows / sz ) || 0;
|
150
152
|
if ( Math.min( p.totalPages, p.filteredPages ) >= 0 ) {
|
151
153
|
t = (p.size * p.page > p.filteredRows);
|
@@ -296,8 +298,8 @@
|
|
296
298
|
// process ajax object
|
297
299
|
if (!$.isArray(result)) {
|
298
300
|
p.ajaxData = result;
|
299
|
-
p.totalRows = result.total;
|
300
|
-
p.filteredRows = typeof result.filteredRows !== 'undefined' ? result.filteredRows : result.total;
|
301
|
+
c.totalRows = p.totalRows = result.total;
|
302
|
+
c.filteredRows = p.filteredRows = typeof result.filteredRows !== 'undefined' ? result.filteredRows : result.total;
|
301
303
|
th = result.headers;
|
302
304
|
d = result.rows;
|
303
305
|
} else {
|
@@ -306,10 +308,12 @@
|
|
306
308
|
// ensure a zero returned row count doesn't fail the logical ||
|
307
309
|
rr_count = result[t ? 1 : 0];
|
308
310
|
p.totalRows = isNaN(rr_count) ? p.totalRows || 0 : rr_count;
|
311
|
+
// can't set filtered rows when returning an array
|
312
|
+
c.totalRows = c.filteredRows = p.filteredRows = p.totalRows;
|
309
313
|
d = p.totalRows === 0 ? [""] : result[t ? 0 : 1] || []; // row data
|
310
314
|
th = result[2]; // headers
|
311
315
|
}
|
312
|
-
l = d.length;
|
316
|
+
l = d && d.length;
|
313
317
|
if (d instanceof jQuery) {
|
314
318
|
if (p.processAjaxOnInit) {
|
315
319
|
// append jQuery object
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**!
|
2
|
-
* TableSorter 2.17.
|
2
|
+
* TableSorter 2.17.4 - 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.17.
|
27
|
+
ts.version = "2.17.4";
|
28
28
|
|
29
29
|
ts.parsers = [];
|
30
30
|
ts.widgets = [];
|
@@ -1487,6 +1487,11 @@
|
|
1487
1487
|
ts.widgets.push(widget);
|
1488
1488
|
};
|
1489
1489
|
|
1490
|
+
ts.hasWidget = function(table, name){
|
1491
|
+
table = $(table);
|
1492
|
+
return table.length && table[0].config && table[0].config.widgetInit[name] || false;
|
1493
|
+
};
|
1494
|
+
|
1490
1495
|
ts.getWidgetById = function(name) {
|
1491
1496
|
var i, w, l = ts.widgets.length;
|
1492
1497
|
for (i = 0; i < l; i++) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! tableSorter 2.16+ widgets - updated
|
1
|
+
/*! tableSorter 2.16+ widgets - updated 7/4/2014 (v2.17.4)
|
2
2
|
*
|
3
3
|
* Column Styles
|
4
4
|
* Column Filters
|
@@ -176,7 +176,7 @@ ts.addWidget({
|
|
176
176
|
id: "uitheme",
|
177
177
|
priority: 10,
|
178
178
|
format: function(table, c, wo) {
|
179
|
-
var i, time, classes, $header, $icon, $tfoot,
|
179
|
+
var i, time, classes, $header, $icon, $tfoot, $h,
|
180
180
|
themesAll = ts.themes,
|
181
181
|
$table = c.$table,
|
182
182
|
$headers = c.$headers,
|
@@ -225,17 +225,20 @@ ts.addWidget({
|
|
225
225
|
for (i = 0; i < c.columns; i++) {
|
226
226
|
$header = c.$headers.add(c.$extraHeaders).filter('[data-column="' + i + '"]');
|
227
227
|
$icon = (ts.css.icon) ? $header.find('.' + ts.css.icon) : $header;
|
228
|
-
|
229
|
-
|
230
|
-
$
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
($header.hasClass(ts.css.
|
236
|
-
|
237
|
-
|
238
|
-
|
228
|
+
$h = c.$headers.filter('[data-column="' + i + '"]:last');
|
229
|
+
if ($h.length) {
|
230
|
+
if ($h[0].sortDisabled) {
|
231
|
+
// no sort arrows for disabled columns!
|
232
|
+
$header.removeClass(remove);
|
233
|
+
$icon.removeClass(remove + ' ' + themes.icons);
|
234
|
+
} else {
|
235
|
+
classes = ($header.hasClass(ts.css.sortAsc)) ?
|
236
|
+
themes.sortAsc :
|
237
|
+
($header.hasClass(ts.css.sortDesc)) ? themes.sortDesc :
|
238
|
+
$header.hasClass(ts.css.header) ? themes.sortNone : '';
|
239
|
+
$header[classes === themes.sortNone ? 'removeClass' : 'addClass'](themes.active);
|
240
|
+
$icon.removeClass(remove).addClass(classes);
|
241
|
+
}
|
239
242
|
}
|
240
243
|
}
|
241
244
|
if (c.debug) {
|
@@ -364,6 +367,7 @@ ts.addWidget({
|
|
364
367
|
filter_reset : null, // jQuery selector string of an element used to reset the filters
|
365
368
|
filter_saveFilters : false, // Use the $.tablesorter.storage utility to save the most recent filters
|
366
369
|
filter_searchDelay : 300, // typing delay in milliseconds before starting a search
|
370
|
+
filter_searchFiltered: true, // allow searching through already filtered rows in special circumstances; will speed up searching in large tables if true
|
367
371
|
filter_selectSource : null, // include a function to return an array of values to be added to the column filter select
|
368
372
|
filter_startsWith : false, // if true, filter start from the beginning of the cell contents
|
369
373
|
filter_useParsedData : false, // filter all data using parsed content
|
@@ -681,7 +685,9 @@ ts.filter = {
|
|
681
685
|
ts.benchmark("Applying Filter widget", time);
|
682
686
|
}
|
683
687
|
// add default values
|
684
|
-
c.$table.bind('tablesorter-initialized pagerInitialized', function() {
|
688
|
+
c.$table.bind('tablesorter-initialized pagerInitialized', function(e) {
|
689
|
+
// redefine "wo" as it does not update properly inside this callback
|
690
|
+
var wo = this.config.widgetOptions;
|
685
691
|
filters = ts.filter.setDefaults(table, c, wo) || [];
|
686
692
|
if (filters.length) {
|
687
693
|
ts.setFilters(table, filters, true);
|
@@ -691,9 +697,16 @@ ts.filter = {
|
|
691
697
|
if (!wo.filter_initialized) {
|
692
698
|
// filter widget initialized
|
693
699
|
wo.filter_initialized = true;
|
694
|
-
c.$table.trigger('filterInit');
|
700
|
+
c.$table.trigger('filterInit', c);
|
695
701
|
}
|
696
702
|
});
|
703
|
+
// if filter widget is added after pager has initialized; then set filter init flag
|
704
|
+
if (c.pager && c.pager.initialized && !wo.filter_initialized) {
|
705
|
+
wo.filter_initialized = true;
|
706
|
+
c.$table
|
707
|
+
.trigger('filterFomatterUpdate')
|
708
|
+
.trigger('filterInit', c);
|
709
|
+
}
|
697
710
|
|
698
711
|
},
|
699
712
|
setDefaults: function(table, c, wo) {
|
@@ -815,6 +828,7 @@ ts.filter = {
|
|
815
828
|
if (event.which === 13 || event.type === 'search' || event.type === 'change') {
|
816
829
|
event.preventDefault();
|
817
830
|
// init search with no delay
|
831
|
+
$(this).attr('data-lastSearchTime', new Date().getTime());
|
818
832
|
ts.filter.searching( table, false, true );
|
819
833
|
}
|
820
834
|
});
|
@@ -928,6 +942,9 @@ ts.filter = {
|
|
928
942
|
$(this).hasClass('filter-parsed');
|
929
943
|
}).get();
|
930
944
|
if (c.debug) { time = new Date(); }
|
945
|
+
// filtered rows count
|
946
|
+
c.filteredRows = 0;
|
947
|
+
c.totalRows = 0;
|
931
948
|
for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
|
932
949
|
if ($tbodies.eq(tbodyIndex).hasClass(c.cssInfoBlock || ts.css.info)) { continue; } // ignore info blocks, issue #264
|
933
950
|
$tbody = ts.processTbody(table, $tbodies.eq(tbodyIndex), true);
|
@@ -944,24 +961,27 @@ ts.filter = {
|
|
944
961
|
$rows = $rows.not('.' + c.cssChildRow);
|
945
962
|
len = $rows.length;
|
946
963
|
// optimize searching only through already filtered rows - see #313
|
947
|
-
searchFiltered =
|
964
|
+
searchFiltered = wo.filter_searchFiltered;
|
948
965
|
lastSearch = c.lastSearch || c.$table.data('lastSearch') || [];
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
//
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
966
|
+
if (searchFiltered) {
|
967
|
+
// cycle through all filters; include last (columnIndex + 1 = match any column). Fixes #669
|
968
|
+
for (indx = 0; indx < columnIndex + 1; indx++) {
|
969
|
+
val = filters[indx] || '';
|
970
|
+
// break out of loop if we've already determined not to search filtered rows
|
971
|
+
if (!searchFiltered) { indx = columnIndex; }
|
972
|
+
// search already filtered rows if...
|
973
|
+
searchFiltered = searchFiltered && lastSearch.length &&
|
974
|
+
// there are no changes from beginning of filter
|
975
|
+
val.indexOf(lastSearch[indx] || '') === 0 &&
|
976
|
+
// if there is NOT a logical "or", or range ("to" or "-") in the string
|
977
|
+
!regex.alreadyFiltered.test(val) &&
|
978
|
+
// if we are not doing exact matches, using "|" (logical or) or not "!"
|
979
|
+
!/[=\"\|!]/.test(val) &&
|
980
|
+
// don't search only filtered if the value is negative ('> -10' => '> -100' will ignore hidden rows)
|
981
|
+
!(/(>=?\s*-\d)/.test(val) || /(<=?\s*\d)/.test(val)) &&
|
982
|
+
// if filtering using a select without a "filter-match" class (exact match) - fixes #593
|
983
|
+
!( val !== '' && c.$filters && c.$filters.eq(indx).find('select').length && !c.$headers.filter('[data-column="' + indx + '"]:last').hasClass('filter-match') );
|
984
|
+
}
|
965
985
|
}
|
966
986
|
notFiltered = $rows.not('.' + wo.filter_filteredRow).length;
|
967
987
|
// can't search when all rows are hidden - this happens when looking for exact matches
|
@@ -1087,6 +1107,8 @@ ts.filter = {
|
|
1087
1107
|
}
|
1088
1108
|
}
|
1089
1109
|
}
|
1110
|
+
c.filteredRows += $rows.not('.' + wo.filter_filteredRow).length;
|
1111
|
+
c.totalRows += $rows.length;
|
1090
1112
|
ts.processTbody(table, $tbody, false);
|
1091
1113
|
}
|
1092
1114
|
c.lastCombinedFilter = combinedFilters; // save last search
|
@@ -1098,7 +1120,7 @@ ts.filter = {
|
|
1098
1120
|
if (c.debug) {
|
1099
1121
|
ts.benchmark("Completed filter widget search", time);
|
1100
1122
|
}
|
1101
|
-
if (wo.filter_initialized) { c.$table.trigger('filterEnd'); }
|
1123
|
+
if (wo.filter_initialized) { c.$table.trigger('filterEnd', c ); }
|
1102
1124
|
setTimeout(function(){
|
1103
1125
|
c.$table.trigger('applyWidgets'); // make sure zebra widget is applied
|
1104
1126
|
}, 0);
|
@@ -1484,19 +1506,31 @@ ts.addWidget({
|
|
1484
1506
|
options: {
|
1485
1507
|
resizable : true,
|
1486
1508
|
resizable_addLastColumn : false,
|
1487
|
-
resizable_widths : []
|
1509
|
+
resizable_widths : [],
|
1510
|
+
resizable_throttle : false // set to true (5ms) or any number 0-10 range
|
1488
1511
|
},
|
1489
1512
|
format: function(table, c, wo) {
|
1490
1513
|
if (c.$table.hasClass('hasResizable')) { return; }
|
1491
1514
|
c.$table.addClass('hasResizable');
|
1492
1515
|
ts.resizableReset(table, true); // set default widths
|
1493
|
-
var $rows, $columns, $column, column,
|
1516
|
+
var $rows, $columns, $column, column, timer,
|
1494
1517
|
storedSizes = {},
|
1495
1518
|
$table = c.$table,
|
1496
1519
|
mouseXPosition = 0,
|
1497
1520
|
$target = null,
|
1498
1521
|
$next = null,
|
1499
1522
|
fullWidth = Math.abs($table.parent().width() - $table.width()) < 20,
|
1523
|
+
mouseMove = function(event){
|
1524
|
+
if (mouseXPosition === 0 || !$target) { return; }
|
1525
|
+
// resize columns
|
1526
|
+
var leftEdge = event.pageX - mouseXPosition,
|
1527
|
+
targetWidth = $target.width();
|
1528
|
+
$target.width( targetWidth + leftEdge );
|
1529
|
+
if ($target.width() !== targetWidth && fullWidth) {
|
1530
|
+
$next.width( $next.width() - leftEdge );
|
1531
|
+
}
|
1532
|
+
mouseXPosition = event.pageX;
|
1533
|
+
},
|
1500
1534
|
stopResize = function() {
|
1501
1535
|
if (ts.storage && $target && $next) {
|
1502
1536
|
storedSizes = {};
|
@@ -1551,21 +1585,6 @@ ts.addWidget({
|
|
1551
1585
|
.append('<div class="' + ts.css.resizer + '" style="cursor:w-resize;position:absolute;z-index:1;right:-' +
|
1552
1586
|
padding + 'px;top:0;height:100%;width:20px;"></div>');
|
1553
1587
|
})
|
1554
|
-
.bind('mousemove.tsresize', function(event) {
|
1555
|
-
// ignore mousemove if no mousedown
|
1556
|
-
if (mouseXPosition === 0 || !$target) { return; }
|
1557
|
-
// resize columns
|
1558
|
-
var leftEdge = event.pageX - mouseXPosition,
|
1559
|
-
targetWidth = $target.width();
|
1560
|
-
$target.width( targetWidth + leftEdge );
|
1561
|
-
if ($target.width() !== targetWidth && fullWidth) {
|
1562
|
-
$next.width( $next.width() - leftEdge );
|
1563
|
-
}
|
1564
|
-
mouseXPosition = event.pageX;
|
1565
|
-
})
|
1566
|
-
.bind('mouseup.tsresize', function() {
|
1567
|
-
stopResize();
|
1568
|
-
})
|
1569
1588
|
.find('.' + ts.css.resizer + ',.' + ts.css.grip)
|
1570
1589
|
.bind('mousedown', function(event) {
|
1571
1590
|
// save header cell and mouse position
|
@@ -1576,17 +1595,30 @@ ts.addWidget({
|
|
1576
1595
|
$next = event.shiftKey ? $target.parent().find('th').not('.resizable-false').filter(':last') : $target.nextAll(':not(.resizable-false)').eq(0);
|
1577
1596
|
mouseXPosition = event.pageX;
|
1578
1597
|
});
|
1579
|
-
$
|
1580
|
-
.bind('
|
1581
|
-
|
1598
|
+
$(document)
|
1599
|
+
.bind('mousemove.tsresize', function(event) {
|
1600
|
+
// ignore mousemove if no mousedown
|
1601
|
+
if (mouseXPosition === 0 || !$target) { return; }
|
1602
|
+
if (wo.resizable_throttle) {
|
1603
|
+
clearTimeout(timer);
|
1604
|
+
timer = setTimeout(function(){
|
1605
|
+
mouseMove(event);
|
1606
|
+
}, isNaN(wo.resizable_throttle) ? 5 : wo.resizable_throttle );
|
1607
|
+
} else {
|
1608
|
+
mouseMove(event);
|
1609
|
+
}
|
1582
1610
|
})
|
1611
|
+
.bind('mouseup.tsresize', function() {
|
1612
|
+
stopResize();
|
1613
|
+
});
|
1614
|
+
|
1583
1615
|
// right click to reset columns to default widths
|
1584
|
-
.bind('contextmenu.tsresize', function() {
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1616
|
+
$table.find('thead:first').bind('contextmenu.tsresize', function() {
|
1617
|
+
ts.resizableReset(table);
|
1618
|
+
// $.isEmptyObject() needs jQuery 1.4+; allow right click if already reset
|
1619
|
+
var allowClick = $.isEmptyObject ? $.isEmptyObject(storedSizes) : true;
|
1620
|
+
storedSizes = {};
|
1621
|
+
return allowClick;
|
1590
1622
|
});
|
1591
1623
|
},
|
1592
1624
|
remove: function(table, c) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* Pager widget
|
1
|
+
/* Pager widget for TableSorter 7/4/2014 (v2.17.4) */
|
2
2
|
/*jshint browser:true, jquery:true, unused:false */
|
3
3
|
;(function($){
|
4
4
|
"use strict";
|
@@ -205,7 +205,7 @@ tsp = ts.pager = {
|
|
205
205
|
p.isInitializing = false;
|
206
206
|
tsp.setPageSize(table, 0, c); // page size 0 is ignored
|
207
207
|
c.$table.trigger('pagerInitialized', c);
|
208
|
-
|
208
|
+
tsp.updatePageDisplay(table, c);
|
209
209
|
},
|
210
210
|
|
211
211
|
bindEvents: function(table, c){
|
@@ -351,6 +351,8 @@ tsp = ts.pager = {
|
|
351
351
|
} else if (!f) {
|
352
352
|
p.filteredRows = p.totalRows;
|
353
353
|
}
|
354
|
+
c.totalRows = p.totalRows;
|
355
|
+
c.filteredRows = p.filteredRows;
|
354
356
|
p.filteredPages = Math.ceil( p.filteredRows / sz ) || 0;
|
355
357
|
if ( Math.min( p.totalPages, p.filteredPages ) >= 0 ) {
|
356
358
|
t = (p.size * p.page > p.filteredRows);
|
@@ -498,8 +500,8 @@ tsp = ts.pager = {
|
|
498
500
|
// process ajax object
|
499
501
|
if (!$.isArray(result)) {
|
500
502
|
p.ajaxData = result;
|
501
|
-
p.totalRows = result.total;
|
502
|
-
p.filteredRows = typeof result.filteredRows !== 'undefined' ? result.filteredRows : result.total;
|
503
|
+
c.totalRows = p.totalRows = result.total;
|
504
|
+
c.filteredRows = p.filteredRows = typeof result.filteredRows !== 'undefined' ? result.filteredRows : result.total;
|
503
505
|
th = result.headers;
|
504
506
|
d = result.rows;
|
505
507
|
} else {
|
@@ -508,10 +510,12 @@ tsp = ts.pager = {
|
|
508
510
|
// ensure a zero returned row count doesn't fail the logical ||
|
509
511
|
rr_count = result[t ? 1 : 0];
|
510
512
|
p.totalRows = isNaN(rr_count) ? p.totalRows || 0 : rr_count;
|
513
|
+
// can't set filtered rows when returning an array
|
514
|
+
c.totalRows = c.filteredRows = p.filteredRows = p.totalRows;
|
511
515
|
d = p.totalRows === 0 ? [""] : result[t ? 0 : 1] || []; // row data
|
512
516
|
th = result[2]; // headers
|
513
517
|
}
|
514
|
-
l = d.length;
|
518
|
+
l = d && d.length;
|
515
519
|
if (d instanceof jQuery) {
|
516
520
|
if (wo.pager_processAjaxOnInit) {
|
517
521
|
// append jQuery object
|
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.12.
|
4
|
+
version: 1.12.4
|
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-06
|
12
|
+
date: 2014-07-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|