jquery-tablesorter 1.9.2 → 1.9.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd8072fae98627808e5938c44867acc67f4da960
4
- data.tar.gz: 0dcb8e09deb35384a953f5b410288544e0a3a0ff
3
+ metadata.gz: 549c6f6e362d81047b6a9082c4529dacaf1c5b71
4
+ data.tar.gz: 6e02e0c0162e732cb5a39ae23c88054ab408bec4
5
5
  SHA512:
6
- metadata.gz: 76c00b6f9215ca57d8954e99a60cc3fb2fdb19c53129d8a70578c920bfb3ee8a01c378bc13b32ebacdea4fa837e61299081546bf19719e6c7cf999dac3647aa9
7
- data.tar.gz: 4a5bdaf3fda234bc2dfe8b18fc88863750c8b6c500086ca62307fe02192bfdfe1e233057eb16fb4bdda898ab72ae3c6f9d2cf5714303881862f1ddf31267f4b5
6
+ metadata.gz: 57c564f0b5230be77f87fbe0850f51f61503da47636f55bf761b48649937e63ace422bc27570e14fe7dee8fedac93c9f0000754b993fd8dcb0da46720cec3b3a
7
+ data.tar.gz: 4fd4f5eb7fcc1b3799c3218160be416b6815da30e5c0436274854517bcebe952794892a4d580b0a4ac15f0f2ffab50ccde730bab03aab43a134c93bb2ded4ff1
@@ -4,7 +4,7 @@
4
4
 
5
5
  Simple integration of jquery-tablesorter into the asset pipeline.
6
6
 
7
- Current tablesorter version: 2.14.2 (11/25/2013), [documentation]
7
+ Current tablesorter version: 2.14.3 (12/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.9.2"
2
+ VERSION = "1.9.3"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * tablesorter pager plugin
3
- * updated 11/22/2013 (v2.14.1)
3
+ * updated 12/2/2013 (v2.14.3)
4
4
  */
5
5
  /*jshint browser:true, jquery:true, unused:false */
6
6
  ;(function($) {
@@ -92,6 +92,7 @@
92
92
  totalPages: 0,
93
93
  filteredRows: 0,
94
94
  filteredPages: 0,
95
+ ajaxCounter: 0,
95
96
  currentFilters: [],
96
97
  startRow: 0,
97
98
  endRow: 0,
@@ -138,8 +139,12 @@
138
139
  })
139
140
  // {totalPages}, {extra}, {extra:0} (array) or {extra : key} (object)
140
141
  .replace(/\{\w+(\s*:\s*\w+)?\}/gi, function(m){
141
- var t = m.replace(/[{}\s]/g,''), a = t.split(':'), d = p.ajaxData;
142
- return a.length > 1 && d && d[a[0]] ? d[a[0]][a[1]] : p[t] || (d ? d[t] : '') || '';
142
+ var str = m.replace(/[{}\s]/g,''),
143
+ extra = str.split(':'),
144
+ data = p.ajaxData,
145
+ // return zero for default page/row numbers
146
+ deflt = /(rows?|pages?)$/i.test(str) ? 0 : '';
147
+ return extra.length > 1 && data && data[extra[0]] ? data[extra[0]][extra[1]] : p[str] || (data ? data[str] : deflt) || deflt;
143
148
  });
144
149
  if (out.length) {
145
150
  out[ (out[0].tagName === 'INPUT') ? 'val' : 'html' ](s);
@@ -278,8 +283,8 @@
278
283
  for ( i = 0; i < l; i++ ) {
279
284
  tds += '<tr>';
280
285
  for ( j = 0; j < d[i].length; j++ ) {
281
- // build tbody cells
282
- tds += '<td>' + d[i][j] + '</td>';
286
+ // build tbody cells; watch for data containing HTML markup - see #434
287
+ tds += /^\s*<td/.test(d[i][j]) ? $.trim(d[i][j]) : '<td>' + d[i][j] + '</td>';
283
288
  }
284
289
  tds += '</tr>';
285
290
  }
@@ -340,6 +345,7 @@
340
345
  getAjax = function(table, p){
341
346
  var url = getAjaxUrl(table, p),
342
347
  $doc = $(document),
348
+ counter,
343
349
  c = table.config;
344
350
  if ( url !== '' ) {
345
351
  if (c.showProcessing) {
@@ -349,8 +355,15 @@
349
355
  renderAjax(null, table, p, xhr, exception);
350
356
  $doc.unbind('ajaxError.pager');
351
357
  });
358
+
359
+ counter = ++p.ajaxCounter;
360
+
352
361
  p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
353
362
  p.ajaxObject.success = function(data) {
363
+ // Refuse to process old ajax commands that were overwritten by new ones - see #443
364
+ if (counter < p.ajaxCounter){
365
+ return;
366
+ }
354
367
  renderAjax(data, table, p);
355
368
  $doc.unbind('ajaxError.pager');
356
369
  if (typeof p.oldAjaxSuccess === 'function') {
@@ -1,5 +1,5 @@
1
1
  /**!
2
- * TableSorter 2.14.2 - Client-side table sorting with ease!
2
+ * TableSorter 2.14.3 - 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.14.2";
27
+ ts.version = "2.14.3";
28
28
 
29
29
  ts.parsers = [];
30
30
  ts.widgets = [];
@@ -1284,11 +1284,11 @@
1284
1284
  if (init || !(c.widgetInit[w.id])) {
1285
1285
  if (w.hasOwnProperty('options')) {
1286
1286
  wo = table.config.widgetOptions = $.extend( true, {}, w.options, wo );
1287
- c.widgetInit[w.id] = true;
1288
1287
  }
1289
1288
  if (w.hasOwnProperty('init')) {
1290
1289
  w.init(table, w, c, wo);
1291
1290
  }
1291
+ c.widgetInit[w.id] = true;
1292
1292
  }
1293
1293
  if (!init && w.hasOwnProperty('format')) {
1294
1294
  w.format(table, c, wo, false);
@@ -1311,7 +1311,8 @@
1311
1311
  for (i = 0; i < l; i++){
1312
1312
  if ( w[i] && w[i].id && (doAll || $.inArray( w[i].id, cw ) < 0) ) {
1313
1313
  if (c.debug) { log( 'Refeshing widgets: Removing ' + w[i].id ); }
1314
- if (w[i].hasOwnProperty('remove')) {
1314
+ // only remove widgets that have been initialized - fixes #442
1315
+ if (w[i].hasOwnProperty('remove') && c.widgetInit[w[i].id]) {
1315
1316
  w[i].remove(table, c, c.widgetOptions);
1316
1317
  c.widgetInit[w[i].id] = false;
1317
1318
  }
@@ -1,4 +1,4 @@
1
- /*! tableSorter 2.8+ widgets - updated 11/24/2013 (v2.14.2)
1
+ /*! tableSorter 2.8+ widgets - updated 12/2/2013 (v2.14.3)
2
2
  *
3
3
  * Column Styles
4
4
  * Column Filters
@@ -422,8 +422,8 @@ ts.filter = {
422
422
  // Look for quotes or equals to get an exact match; ignore type since iExact could be numeric
423
423
  exact: function( filter, iFilter, exact, iExact ) {
424
424
  /*jshint eqeqeq:false */
425
- if ( iFilter.replace(ts.filter.regex.exact, '') == iExact ) {
426
- return true;
425
+ if (ts.filter.regex.exact.test(iFilter)) {
426
+ return iFilter.replace(ts.filter.regex.exact, '') == iExact;
427
427
  }
428
428
  return null;
429
429
  },
@@ -479,7 +479,7 @@ ts.filter = {
479
479
  // Look for a range (using " to " or " - ") - see issue #166; thanks matzhu!
480
480
  range : function( filter, iFilter, exact, iExact, cached, index, table, wo, parsed ) {
481
481
  if ( /\s+(-|to)\s+/.test(iFilter) ) {
482
- var result,
482
+ var result, tmp,
483
483
  c = table.config,
484
484
  query = iFilter.split(/(?: - | to )/), // make sure the dash is for a range and not indicating a negative number
485
485
  range1 = ts.formatFloat(query[0].replace(ts.filter.regex.nondigit, ''), table),
@@ -494,7 +494,7 @@ ts.filter = {
494
494
  result = ( parsed[index] || c.parsers[index].type === 'numeric' ) && !isNaN(range1) && !isNaN(range2) ? cached :
495
495
  isNaN(iExact) ? ts.formatFloat( iExact.replace(ts.filter.regex.nondigit, ''), table) :
496
496
  ts.formatFloat( iExact, table );
497
- if (range1 > range2) { result = range1; range1 = range2; range2 = result; } // swap
497
+ if (range1 > range2) { tmp = range1; range1 = range2; range2 = tmp; } // swap
498
498
  return (result >= range1 && result <= range2) || (range1 === '' || range2 === '');
499
499
  }
500
500
  return null;
@@ -605,7 +605,7 @@ ts.filter = {
605
605
  });
606
606
 
607
607
  if (wo.filter_hideFilters) {
608
- ts.filter.hideFilters(table, c, wo);
608
+ ts.filter.hideFilters(table, c);
609
609
  }
610
610
 
611
611
  // show processing icon
@@ -712,6 +712,7 @@ ts.filter = {
712
712
  var external, wo = table.config.widgetOptions;
713
713
  $el.unbind('keyup search filterReset')
714
714
  .bind('keyup search', function(event, filter) {
715
+ var $this = $(this);
715
716
  // emulate what webkit does.... escape clears the filter
716
717
  if (event.which === 27) {
717
718
  this.value = '';
@@ -722,7 +723,7 @@ ts.filter = {
722
723
  return;
723
724
  }
724
725
  // external searches won't have a filter parameter, so grab the value
725
- if ($(this).hasClass('tablesorter-filter')) {
726
+ if ($this.hasClass('tablesorter-filter') && !$this.hasClass('tablesorter-external-filter')) {
726
727
  external = filter;
727
728
  } else {
728
729
  external = [];
@@ -766,7 +767,7 @@ ts.filter = {
766
767
  return false;
767
768
  }
768
769
  },
769
- hideFilters: function(table, c, wo) {
770
+ hideFilters: function(table, c) {
770
771
  var $filterRow, $filterRow2, timer;
771
772
  c.$table
772
773
  .find('.tablesorter-filter-row')
@@ -824,7 +825,8 @@ ts.filter = {
824
825
  for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
825
826
  if ($tbodies.eq(tbodyIndex).hasClass(ts.css.info)) { continue; } // ignore info blocks, issue #264
826
827
  $tbody = ts.processTbody(table, $tbodies.eq(tbodyIndex), true);
827
- $rows = $tbody.children('tr').not('.' + c.cssChildRow).not('.group-header');
828
+ // skip child rows & widget added (removable) rows - fixes #448 thanks to @hempel!
829
+ $rows = $tbody.children('tr').not('.' + c.cssChildRow).not(c.selectorRemove);
828
830
  len = $rows.length;
829
831
  if (combinedFilters === '' || wo.filter_serversideFiltering) {
830
832
  $tbody.children().show().removeClass(wo.filter_filteredRow);
@@ -1083,7 +1085,6 @@ ts.addWidget({
1083
1085
  $stickyCells,
1084
1086
  laststate = '',
1085
1087
  spacing = 0,
1086
- updatingStickyFilters = false,
1087
1088
  nonwkie = $table.css('border-collapse') !== 'collapse' && !/(webkit|msie)/i.test(navigator.userAgent),
1088
1089
  resizeHeader = function() {
1089
1090
  stickyOffset = $stickyOffset.length ? $stickyOffset.height() || 0 : parseInt(wo.stickyHeaders_offset, 10) || 0;
@@ -1193,24 +1194,20 @@ ts.addWidget({
1193
1194
  }
1194
1195
 
1195
1196
  // look for filter widget
1196
- $table.bind('filterEnd', function() {
1197
- if (updatingStickyFilters) { return; }
1198
- $stickyThead.find('.tablesorter-filter-row').children().each(function(indx) {
1199
- $(this).find(filterInputs).val( c.$filters.find(filterInputs).eq(indx).val() );
1197
+ if ($table.hasClass('hasFilters')) {
1198
+ $table.bind('filterEnd', function() {
1199
+ // $(':focus') needs jQuery 1.6+
1200
+ if ( $(document.activeElement).closest('thead')[0] !== $stickyThead[0] ) {
1201
+ // don't update the stickyheader filter row if it already has focus
1202
+ $stickyThead.find('.tablesorter-filter-row').children().each(function(indx) {
1203
+ $(this).find(filterInputs).val( c.$filters.find(filterInputs).eq(indx).val() );
1204
+ });
1205
+ }
1200
1206
  });
1201
- });
1202
- $stickyCells.find(filterInputs).bind('keyup search change', function(event) {
1203
- // ignore arrow and meta keys; allow backspace
1204
- if ((event.which < 32 && event.which !== 8) || (event.which >= 37 && event.which <=40)) { return; }
1205
- updatingStickyFilters = true;
1206
- var $f = $(this), column = $f.attr('data-column');
1207
- c.$filters.find(filterInputs).eq(column)
1208
- .val( $f.val() )
1209
- .trigger('search');
1210
- setTimeout(function() {
1211
- updatingStickyFilters = false;
1212
- }, wo.filter_searchDelay);
1213
- });
1207
+
1208
+ ts.filter.bindSearch( $table, $stickyCells.find('.tablesorter-filter').addClass('tablesorter-external-filter') );
1209
+ }
1210
+
1214
1211
  $table.trigger('stickyHeadersInit');
1215
1212
 
1216
1213
  },
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.9.2
4
+ version: 1.9.3
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-11-25 00:00:00.000000000 Z
12
+ date: 2013-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties