jquery-tablesorter 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b894fbd38fd0b3ea6b2606395da5b3d9610e0164
4
- data.tar.gz: 3f45a27f4f427e5f4596885a560587adae9a9a86
3
+ metadata.gz: acfcfbdcbf520532b495a3aa784033d4ec287a30
4
+ data.tar.gz: 002c5105872cb05cf0d4f7d2f78d027fc8fc7864
5
5
  SHA512:
6
- metadata.gz: 3c8e1f14359f525dcaf865a6bcabf56589faa509ecf5c4d36a9fe9ef9ff79be759c123f03c9141604fdb825451f28b31a4fc40e2548dde68fba46bd3bc77bbc2
7
- data.tar.gz: ed439ddc82f74905ca27944b83cf35d5d89e3838a3b6b13b0003aa9bc334edaaf7f4ce34dff9fb8d0a8288102604c8a5d51d18bc4552dca75278a629a35ea329
6
+ metadata.gz: 171363daa41553a03cbca64f9c58bac9810d9c3b4f87509eda0713bee18bc0989ee2beca7b29247987085c379ccd97735382dd3f54f03ed4ffaf9f8df1938815
7
+ data.tar.gz: 5c0a43f4f40e32e946ed3e500d9f7012ffffe50803fb6a880a51d4648672435cd5fcde8e3d5abb33abb57cf511d60acac63766db00f678f63015223266f79ed6
@@ -4,7 +4,7 @@
4
4
 
5
5
  Simple integration of jquery-tablesorter into the asset pipeline.
6
6
 
7
- Current tablesorter version: 2.12 (10/18/2013), [documentation]
7
+ Current tablesorter version: 2.13.2 (11/2/2013), [documentation]
8
8
 
9
9
  Any issue associate with the js/css files, please report to [Mottie's fork].
10
10
 
@@ -1,3 +1,3 @@
1
1
  module JqueryTablesorter
2
- VERSION = "1.7.0"
2
+ VERSION = "1.8.0"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * tablesorter pager plugin
3
- * updated 10/18/2013
3
+ * updated 10/30/2013
4
4
  */
5
5
  /*jshint browser:true, jquery:true, unused:false */
6
6
  ;(function($) {
@@ -65,6 +65,11 @@
65
65
  // table row set to a height to compensate; default is false
66
66
  fixedHeight: false,
67
67
 
68
+ // count child rows towards the set page size? (set true if it is a visible table row within the pager)
69
+ // if true, child row(s) may not appear to be attached to its parent row, may be split across pages or
70
+ // may distort the table if rowspan or cellspans are included.
71
+ countChildRows: false,
72
+
68
73
  // remove rows from the table to speed up the sort of large tables.
69
74
  // setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
70
75
  removeRows: false, // removing rows in larger tables speeds up the sort
@@ -199,7 +204,7 @@
199
204
  if ( !rows[i].className.match(f) ) {
200
205
  rows[i].style.display = ( j >= s && j < e ) ? '' : 'none';
201
206
  // don't count child rows
202
- j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.slice(1)) ? 0 : 1;
207
+ j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.slice(1)) && !p.countChildRows ? 0 : 1;
203
208
  }
204
209
  }
205
210
  }
@@ -524,10 +529,11 @@
524
529
  };
525
530
 
526
531
  $this.appender = function(table, rows) {
527
- var p = table.config.pager;
532
+ var c = table.config,
533
+ p = c.pager;
528
534
  if ( !p.ajax ) {
529
- table.config.rowsCopy = rows;
530
- p.totalRows = rows.length;
535
+ c.rowsCopy = rows;
536
+ p.totalRows = p.countChildRows ? c.$tbodies.eq(0).children().length : rows.length;
531
537
  p.size = $.data(table, 'pagerLastSize') || p.size;
532
538
  p.totalPages = Math.ceil( p.totalRows / ( p.size || 10 ) );
533
539
  renderTable(table, rows, p);
@@ -1,5 +1,5 @@
1
1
  /**!
2
- * TableSorter 2.12.0 - Client-side table sorting with ease!
2
+ * TableSorter 2.13.2 - 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.12.0";
27
+ ts.version = "2.13.2";
28
28
 
29
29
  ts.parsers = [];
30
30
  ts.widgets = [];
@@ -1066,11 +1066,10 @@
1066
1066
  if (a === b) { return 0; }
1067
1067
  var xN, xD, yN, yD, xF, yF, i, mx,
1068
1068
  r = ts.regex;
1069
- // numeric or hex detection
1070
- yD = parseInt(b.match(r.hex), 16);
1071
1069
  // first try and sort Hex codes
1072
- if (yD) {
1070
+ if (r.hex.test(b)) {
1073
1071
  xD = parseInt(a.match(r.hex), 16);
1072
+ yD = parseInt(b.match(r.hex), 16);
1074
1073
  if ( xD < yD ) { return -1; }
1075
1074
  if ( xD > yD ) { return 1; }
1076
1075
  }
@@ -1317,7 +1316,7 @@
1317
1316
  }
1318
1317
  if(/^\s*\([.\d]+\)/.test(s)) {
1319
1318
  // make (#) into a negative number -> (10) = -10
1320
- s = s.replace(/^\s*\(/,'-').replace(/\)/,'');
1319
+ s = s.replace(/^\s*\(([.\d]+)\)/, '-$1');
1321
1320
  }
1322
1321
  i = parseFloat(s);
1323
1322
  // return the text instead of zero
@@ -1,4 +1,4 @@
1
- /*! Filter widget formatter functions - updated 10/10/2013
1
+ /*! Filter widget formatter functions - updated 10/30/2013
2
2
  * requires: tableSorter 2.7.7+ and jQuery 1.4.3+
3
3
  *
4
4
  * uiSpinner (jQuery UI spinner)
@@ -519,7 +519,7 @@ $.tablesorter.filterFormatter = {
519
519
  var localfrom = o.defaultDate = o.from || o.defaultDate;
520
520
 
521
521
  closeFrom = o.onClose = function( selectedDate, ui ) {
522
- var from = new Date( selectedDate ).getTime() || '',
522
+ var from = new Date( $cell.find('.dateFrom').datepicker('getDate') ).getTime() || '',
523
523
  to = new Date( $cell.find('.dateTo').datepicker('getDate') ).getTime() || '',
524
524
  range = from ? ( to ? from + ' - ' + to : '>=' + from ) : (to ? '<=' + to : '');
525
525
  $cell
@@ -542,7 +542,7 @@ $.tablesorter.filterFormatter = {
542
542
  o.defaultDate = o.to || '+7d'; // set to date +7 days from today (if not defined)
543
543
  closeTo = o.onClose = function( selectedDate, ui ) {
544
544
  var from = new Date( $cell.find('.dateFrom').datepicker('getDate') ).getTime() || '',
545
- to = new Date( selectedDate ).getTime() || '',
545
+ to = new Date( $cell.find('.dateTo').datepicker('getDate') ).getTime() || '',
546
546
  range = from ? ( to ? from + ' - ' + to : '>=' + from ) : (to ? '<=' + to : '');
547
547
  $cell
548
548
  .find('.dateRange').val(range)
@@ -608,7 +608,7 @@ $.tablesorter.filterFormatter = {
608
608
  $number = $('<input type="number" style="visibility:hidden;" value="test">').appendTo($cell),
609
609
  // test if HTML5 number is supported - from Modernizr
610
610
  numberSupported = o.skipTest || $number.attr('type') === 'number' && $number.val() !== 'test',
611
- t, l, $shcell = [],
611
+ l, $shcell = [],
612
612
  c = $cell.closest('table')[0].config,
613
613
 
614
614
  updateCompare = function(v) {
@@ -1,4 +1,4 @@
1
- /*! tableSorter 2.8+ widgets - updated 10/18/2013
1
+ /*! tableSorter 2.8+ widgets - updated 11/2/2013
2
2
  *
3
3
  * Column Styles
4
4
  * Column Filters
@@ -123,7 +123,7 @@ ts.addHeaderResizeEvent = function(table, disable, options){
123
123
  wo.resize_flag = true;
124
124
  headers = [];
125
125
  c.$headers.each(function(){
126
- var d = $.data(this, 'savedSizes'),
126
+ var d = $.data(this, 'savedSizes') || [0,0], // fixes #394
127
127
  w = this.offsetWidth,
128
128
  h = this.offsetHeight;
129
129
  if (w !== d[0] || h !== d[1]) {
@@ -134,14 +134,14 @@ ts.addHeaderResizeEvent = function(table, disable, options){
134
134
  if (headers.length) { c.$table.trigger('resize', [ headers ]); }
135
135
  wo.resize_flag = false;
136
136
  };
137
+ c.$headers.each(function(){
138
+ $.data(this, 'savedSizes', [ this.offsetWidth, this.offsetHeight ]);
139
+ });
137
140
  clearInterval(wo.resize_timer);
138
141
  if (disable) {
139
142
  wo.resize_flag = false;
140
143
  return false;
141
144
  }
142
- c.$headers.each(function(){
143
- $.data(this, 'savedSizes', [ this.offsetWidth, this.offsetHeight ]);
144
- });
145
145
  wo.resize_timer = setInterval(function(){
146
146
  if (wo.resize_flag) { return; }
147
147
  checkSizes();
@@ -399,7 +399,7 @@ ts.addWidget({
399
399
  }
400
400
  },
401
401
  findRows = function(filter, v, cv){
402
- var $tb, $tr, $td, cr, r, l, ff, time, r1, r2, searchFiltered;
402
+ var $tb, $tr, $td, cr, r, l, ff, fr, time, r1, r2, searchFiltered;
403
403
  if (c.debug) { time = new Date(); }
404
404
  for (k = 0; k < b.length; k++ ){
405
405
  if (b.eq(k).hasClass(ts.css.info)) { continue; } // ignore info blocks, issue #264
@@ -477,11 +477,11 @@ ts.addWidget({
477
477
  ff = val === '' ? true : !(wo.filter_startsWith ? s === 0 : s >= 0);
478
478
  // Look for operators >, >=, < or <=
479
479
  } else if (/^[<>]=?/.test(val)){
480
- s = fmt(val.replace(wo.filter_regex.nondigit, '').replace(wo.filter_regex.operators,''), table);
480
+ s = fr = fmt(val.replace(wo.filter_regex.nondigit, '').replace(wo.filter_regex.operators,''), table);
481
481
  // parse filter value in case we're comparing numbers (dates)
482
482
  if (parsed[i] || c.parsers[i].type === 'numeric') {
483
483
  rg = c.parsers[i].format('' + val.replace(wo.filter_regex.operators,''), table, $ths.eq(i), i);
484
- s = (rg !== '' && !isNaN(rg)) ? rg : s;
484
+ s = (isNaN(s) && rg !== '' && !isNaN(rg)) ? rg : s;
485
485
  }
486
486
  // xi may be numeric - see issue #149;
487
487
  // check if c.cache[k].normalized[j] is defined, because sometimes j goes out of range? (numeric columns)
@@ -489,7 +489,7 @@ ts.addWidget({
489
489
  isNaN(xi) ? fmt(xi.replace(wo.filter_regex.nondigit, ''), table) : fmt(xi, table);
490
490
  if (/>/.test(val)) { ff = />=/.test(val) ? rg >= s : rg > s; }
491
491
  if (/</.test(val)) { ff = /<=/.test(val) ? rg <= s : rg < s; }
492
- if (s === '') { ff = true; } // keep showing all rows if nothing follows the operator
492
+ if (!ff && fr === '') { ff = true; } // keep showing all rows if nothing follows the operator
493
493
  // Look for an AND or && operator (logical and)
494
494
  } else if (/\s+(AND|&&)\s+/g.test(v[i])) {
495
495
  s = val.split(/(?:\s+(?:and|&&)\s+)/g);
@@ -533,7 +533,12 @@ ts.addWidget({
533
533
  }
534
534
  $tr[j].style.display = (r ? '' : 'none');
535
535
  $tr.eq(j)[r ? 'removeClass' : 'addClass'](wo.filter_filteredRow);
536
- if (cr.length) { cr[r ? 'show' : 'hide'](); }
536
+ if (cr.length) {
537
+ if (c.pager && c.pager.countChildRows || wo.pager_countChildRows) {
538
+ cr[r ? 'removeClass' : 'addClass'](wo.filter_filteredRow); // see issue #396
539
+ }
540
+ cr[r ? 'show' : 'hide']();
541
+ }
537
542
  }
538
543
  }
539
544
  ts.processTbody(table, $tb, false);
@@ -754,9 +759,7 @@ ts.addWidget({
754
759
  // $(':focus') needs jQuery 1.6+
755
760
  if ($(document.activeElement).closest('tr')[0] !== ft[0]){
756
761
  // get all filter values
757
- all = $t.find('.tablesorter-filter').map(function(){
758
- return $(this).val() || '';
759
- }).get().join('');
762
+ all = ts.getFilters(table).join('');
760
763
  // don't hide row if any filter has a value
761
764
  if (all === ''){
762
765
  ft.addClass('hideme');
@@ -770,7 +773,7 @@ ts.addWidget({
770
773
  clearTimeout(st);
771
774
  st = setTimeout(function(){
772
775
  // don't hide row if any filter has a value
773
- if ($t.find('.tablesorter-filter').map(function(){ return $(this).val() || ''; }).get().join('') === ''){
776
+ if (ts.getFilters(table).join('') === ''){
774
777
  ft2[ e.type === 'focus' ? 'removeClass' : 'addClass']('hideme');
775
778
  }
776
779
  }, 200);
@@ -820,22 +823,22 @@ ts.addWidget({
820
823
  $tb.children().removeClass(wo.filter_filteredRow).show();
821
824
  ts.processTbody(table, $tb, false); // restore tbody
822
825
  }
823
- if (wo.filterreset) { $(document).undelegate(wo.filter_reset, 'click.tsfilter'); }
826
+ if (wo.filter_reset) { $(document).undelegate(wo.filter_reset, 'click.tsfilter'); }
824
827
  }
825
828
  });
826
829
  ts.getFilters = function(table) {
827
830
  var c = table ? $(table)[0].config : {};
828
831
  if (c && c.widgetOptions && !c.widgetOptions.filter_columnFilters) { return $(table).data('lastSearch'); }
829
- return c && c.$filters ? c.$filters.find('.tablesorter-filter').map(function(i, el) {
830
- return $(el).val();
832
+ return c && c.$filters ? c.$filters.map(function(i, el) {
833
+ return $(el).find('.tablesorter-filter').val() || '';
831
834
  }).get() || [] : false;
832
835
  };
833
836
  ts.setFilters = function(table, filter, apply) {
834
837
  var $t = $(table),
835
838
  c = $t.length ? $t[0].config : {},
836
- valid = c && c.$filters ? c.$filters.find('.tablesorter-filter').each(function(i, el) {
837
- $(el).val(filter[i] || '');
838
- }).trigger('change.tsfilter') || false : false;
839
+ valid = c && c.$filters ? c.$filters.each(function(i, el) {
840
+ $(el).find('.tablesorter-filter').val(filter[i] || '');
841
+ }) || false : false;
839
842
  if (apply) { $t.trigger('search', [filter, false]); }
840
843
  return !!valid;
841
844
  };
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.7.0
4
+ version: 1.8.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-20 00:00:00.000000000 Z
12
+ date: 2013-11-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties