jquery-tablesorter 1.13.0 → 1.13.1

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: 352f918783831cc401eb8b3c9a8ed8d0b1dbf1aa
4
- data.tar.gz: 8d49de1c504051729de9cb5a9434542c479a9f0c
3
+ metadata.gz: c94cde7d33b48778ade7b2c35ba5b58d74a53e04
4
+ data.tar.gz: 79075db7962f26823765fdb5b16f0dd9865381d7
5
5
  SHA512:
6
- metadata.gz: 4e11a4e7722b7eb97301d93caa25eefcade3a83750f68cb0a9608947e0d728537db07e408af70ec553269994569b6b66819467fec67aa0e96da1d5ef27cb32de
7
- data.tar.gz: 9e1d3646f6ce66a39135020b2a94359018c96f824834046fb21e302879b336d98a7b50e18252fa52f518824db5a184969cf981232a273cfc14adbf6725deb125
6
+ metadata.gz: 60e78ca094a503b9b4421f064372d0022fecf6848e432387d2f6b32f971aff3a240977ab4501c92dd3f9a57668cc53ebf8ba6682225e4663171412ddf897eacc
7
+ data.tar.gz: f84fd99b9a51abc82064926a0113fb356abbaa834477fb98d30119c887d60b6cbd4be14cac139875246ef38c89965c5965830afaee7202a06d52f1de99ab420e
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.18.0 (10/26/2014), [documentation]
7
+ Current tablesorter version: 2.18.1 (11/3/2014), [documentation]
8
8
 
9
9
  Any issue associated with the js/css files, please report to [Mottie's fork].
10
10
 
@@ -1,3 +1,3 @@
1
1
  module JqueryTablesorter
2
- VERSION = '1.13.0'
2
+ VERSION = '1.13.1'
3
3
  end
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * tablesorter pager plugin
3
- * updated 10/26/2014 (v2.18.0)
3
+ * updated 11/3/2014 (v2.18.1)
4
4
  */
5
5
  /*jshint browser:true, jquery:true, unused:false */
6
6
  ;(function($) {
@@ -150,7 +150,7 @@
150
150
  },
151
151
 
152
152
  updatePageDisplay = function(table, p, completed) {
153
- if ( !p.initialized ) { return; }
153
+ if ( p.initializing ) { return; }
154
154
  var s, t, $out,
155
155
  c = table.config,
156
156
  sz = p.size || 10; // don't allow dividing by zero
@@ -328,7 +328,7 @@
328
328
  } else {
329
329
  rows[i].style.display = ( j >= s && j < e ) ? '' : 'none';
330
330
  // don't count child rows
331
- j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.replace(/^(\w+\.)/g,'')) && !p.countChildRows ? 0 : 1;
331
+ j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.slice(1)) && !p.countChildRows ? 0 : 1;
332
332
  if ( j === e && rows[i].style.display !== 'none' && rows[i].className.match(ts.css.cssHasChild) ) {
333
333
  lastIndex = i;
334
334
  }
@@ -477,9 +477,11 @@
477
477
  }
478
478
  if (!p.initialized) {
479
479
  p.initialized = true;
480
+ p.initializing = false;
480
481
  $(table)
481
482
  .trigger('applyWidgets')
482
483
  .trigger('pagerInitialized', p);
484
+ updatePageDisplay(table, p);
483
485
  }
484
486
  },
485
487
 
@@ -499,6 +501,7 @@
499
501
 
500
502
  counter = ++p.ajaxCounter;
501
503
 
504
+ p.last.ajaxUrl = url; // remember processed url
502
505
  p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
503
506
  p.ajaxObject.success = function(data, status, jqxhr) {
504
507
  // Refuse to process old ajax commands that were overwritten by new ones - see #443
@@ -602,7 +605,7 @@
602
605
  }
603
606
  ts.processTbody(table, $tb, false);
604
607
  }
605
- updatePageDisplay(table, p, true);
608
+ updatePageDisplay(table, p);
606
609
  if (table.isUpdating) {
607
610
  $t.trigger('updateComplete', [ table, true ]);
608
611
  }
@@ -659,10 +662,13 @@
659
662
  if ( pageMoved !== false && p.initialized && $.isEmptyObject(c.cache)) {
660
663
  return updateCache(table);
661
664
  }
665
+ // abort page move if the table has filters and has not been initialized
666
+ if (p.ajax && ts.hasWidget(table, 'filter') && !c.widgetOptions.filter_initialized) { return; }
662
667
  calcFilters(table, p);
663
668
  pg = Math.min( p.totalPages, p.filteredPages );
664
669
  if ( p.page < 0 ) { p.page = 0; }
665
670
  if ( p.page > ( pg - 1 ) && pg !== 0 ) { p.page = pg - 1; }
671
+
666
672
  // fixes issue where one currentFilter is [] and the other is ['','',''],
667
673
  // making the next if comparison think the filters are different (joined by commas). Fixes #202.
668
674
  l.currentFilters = (l.currentFilters || []).join('') === '' ? [] : l.currentFilters;
@@ -746,7 +752,7 @@
746
752
  table.config.appender = null; // remove pager appender function
747
753
  p.initialized = false;
748
754
  delete table.config.rowsCopy;
749
- $(table).unbind('destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager');
755
+ $(table).unbind('filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet '.split(' ').join('.pager '));
750
756
  if (ts.storage) {
751
757
  ts.storage(table, p.storageKey, '');
752
758
  }
@@ -812,12 +818,7 @@
812
818
  }
813
819
  p.oldAjaxSuccess = p.oldAjaxSuccess || p.ajaxObject.success;
814
820
  c.appender = $this.appender;
815
- if (ts.filter && $.inArray('filter', c.widgets) >= 0) {
816
- // get any default filter settings (data-value attribute) fixes #388
817
- p.currentFilters = c.$table.data('lastSearch') || ts.filter.setDefaults(table, c, c.widgetOptions) || [];
818
- // set, but don't apply current filters
819
- ts.setFilters(table, p.currentFilters, false);
820
- }
821
+ p.initializing = true;
821
822
  if (p.savePages && ts.storage) {
822
823
  t = ts.storage(table, p.storageKey) || {}; // fixes #387
823
824
  p.page = isNaN(t.page) ? p.page : t.page;
@@ -826,20 +827,21 @@
826
827
  }
827
828
 
828
829
  // skipped rows
829
- p.regexRows = new RegExp('(' + (wo.filter_filteredRow || 'filtered') + '|' + c.selectorRemove.replace(/^(\w+\.)/g,'') + '|' + c.cssChildRow + ')');
830
+ p.regexRows = new RegExp('(' + (wo.filter_filteredRow || 'filtered') + '|' + c.selectorRemove.slice(1) + '|' + c.cssChildRow + ')');
830
831
 
831
832
  $t
832
- .unbind('filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet '.split(' ').join('.pager '))
833
- .bind('filterStart.pager', function(e, filters) {
834
- p.currentFilters = filters;
835
- // don't change page is filters are the same (pager updating, etc)
836
- if (p.pageReset !== false && (c.lastCombinedFilter || '') !== (filters || []).join('')) {
833
+ .unbind('filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet '.split(' ').join('.pager '))
834
+ .bind('filterInit.pager filterStart.pager', function() {
835
+ p.currentFilters = c.$table.data('lastSearch');
836
+ // don't change page if filters are the same (pager updating, etc)
837
+ if (p.pageReset !== false && (c.lastCombinedFilter || '') !== (p.currentFilters || []).join('')) {
837
838
  p.page = p.pageReset; // fixes #456 & #565
838
839
  }
839
840
  })
840
841
  // update pager after filter widget completes
841
842
  .bind('filterEnd.pager sortEnd.pager', function() {
842
- if (p.initialized) {
843
+ p.currentFilters = c.$table.data('lastSearch');
844
+ if (p.initialized || p.initializing) {
843
845
  if (c.delayInit && c.rowsCopy && c.rowsCopy.length === 0) {
844
846
  // make sure we have a copy of all table rows once the cache has been built
845
847
  updateCache(table);
@@ -946,7 +948,6 @@
946
948
  $t.trigger('pagerBeforeInitialized', p);
947
949
 
948
950
  enablePager(table, p, false);
949
-
950
951
  if ( typeof(p.ajaxUrl) === 'string' ) {
951
952
  // ajax pager; interact with database
952
953
  p.ajax = true;
@@ -962,10 +963,14 @@
962
963
  }
963
964
 
964
965
  // pager initialized
965
- if (!p.ajax) {
966
+ if (!p.ajax && !p.initialized) {
967
+ p.initializing = false;
966
968
  p.initialized = true;
967
- updatePageDisplay(table, p, true);
969
+ moveToPage(table, p);
968
970
  $(table).trigger('pagerInitialized', p);
971
+ if ( !( c.widgetOptions.filter_initialized && ts.hasWidget(table, 'filter') ) ) {
972
+ updatePageDisplay(table, c, false);
973
+ }
969
974
  }
970
975
  });
971
976
  };
@@ -988,7 +993,7 @@
988
993
  })
989
994
  // add error row to thead instead of tbody, or clicking on the header will result in a parser error
990
995
  .appendTo( c.$table.find('thead:first') )
991
- .addClass( errorRow + ' ' + c.selectorRemove.replace(/^(\w+\.)/g,'') )
996
+ .addClass( errorRow + ' ' + c.selectorRemove.slice(1) )
992
997
  .attr({
993
998
  role : 'alert',
994
999
  'aria-live' : 'assertive'
@@ -1,5 +1,5 @@
1
1
  /**!
2
- * TableSorter 2.18.0 - Client-side table sorting with ease!
2
+ * TableSorter 2.18.1 - 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.18.0";
27
+ ts.version = "2.18.1";
28
28
 
29
29
  ts.parsers = [];
30
30
  ts.widgets = [];
@@ -92,6 +92,7 @@
92
92
  cssChildRow : 'tablesorter-childRow', // class name indiciating that a row is to be attached to the its parent
93
93
  cssIcon : 'tablesorter-icon', // if this class exists, a <i> will be added to the header automatically
94
94
  cssInfoBlock : 'tablesorter-infoOnly', // don't sort tbody with this class name (only one class name allowed here!)
95
+ cssAllowClicks : 'tablesorter-allowClicks', // class name added to table header which allows clicks to bubble up
95
96
 
96
97
  // *** selectors
97
98
  selectorHeaders : '> thead th, > thead td',
@@ -1159,13 +1160,11 @@
1159
1160
  }
1160
1161
  for (k in obj) {
1161
1162
  if (typeof k === 'string') {
1162
- if (getCell) {
1163
- // get header cell
1164
- $h = c.$headers.eq(indx).filter(k);
1165
- } else {
1166
- // get column indexed cell
1167
- $h = c.$headers.filter('[data-column="' + indx + '"]:last').filter(k);
1168
- }
1163
+ $h = c.$headers.filter('[data-column="' + indx + '"]:last')
1164
+ // header cell with class/id
1165
+ .filter(k)
1166
+ // find elements within the header cell with cell/id
1167
+ .add( c.$headers.filter('[data-column="' + indx + '"]:last').find(k) );
1169
1168
  if ($h.length) {
1170
1169
  return obj[k];
1171
1170
  }
@@ -1286,7 +1285,9 @@
1286
1285
  // set timer on mousedown
1287
1286
  if (type === 'mousedown') {
1288
1287
  downTime = new Date().getTime();
1289
- return /(input|select|button|textarea)/i.test(e.target.tagName) ? '' : !c.cancelSelection;
1288
+ return /(input|select|button|textarea)/i.test(e.target.tagName) ||
1289
+ // allow clicks to contents of selected cells
1290
+ $(e.target).closest('td,th').hasClass(c.cssAllowClicks) ? '' : !c.cancelSelection;
1290
1291
  }
1291
1292
  if (c.delayInit && isEmptyObject(c.cache)) { buildCache(table); }
1292
1293
  // jQuery v1.2.6 doesn't have closest()
@@ -1,4 +1,4 @@
1
- /*! tableSorter 2.16+ widgets - updated 10/26/2014 (v2.18.0)
1
+ /*! tableSorter 2.16+ widgets - updated 11/3/2014 (v2.18.1)
2
2
  *
3
3
  * Column Styles
4
4
  * Column Filters
@@ -206,8 +206,9 @@ ts.addWidget({
206
206
  .children('tfoot');
207
207
  if ($tfoot.length) {
208
208
  $tfoot
209
- .children('tr').removeClass(oldtheme.footerRow).addClass(themes.footerRow)
210
- .children('th, td').removeClass(oldtheme.footerCells).addClass(themes.footerCells);
209
+ // if oldtheme.footerRow or oldtheme.footerCells are undefined, all class names are removed
210
+ .children('tr').removeClass(oldtheme.footerRow || '').addClass(themes.footerRow)
211
+ .children('th, td').removeClass(oldtheme.footerCells || '').addClass(themes.footerCells);
211
212
  }
212
213
  // update header classes
213
214
  $headers
@@ -595,7 +596,6 @@ ts.filter = {
595
596
  wo.filter_initTimer = null;
596
597
  wo.filter_formatterCount = 0;
597
598
  wo.filter_formatterInit = [];
598
- wo.filter_initializing = true;
599
599
  wo.filter_anyColumnSelector = '[data-column="all"],[data-column="any"]';
600
600
  wo.filter_multipleColumnSelector = '[data-column*="-"],[data-column*=","]';
601
601
 
@@ -722,7 +722,7 @@ ts.filter = {
722
722
  c.filteredRows = c.totalRows;
723
723
 
724
724
  // add default values
725
- c.$table.bind('tablesorter-initialized pagerInitialized', function() {
725
+ c.$table.bind('tablesorter-initialized pagerBeforeInitialized', function() {
726
726
  // redefine "wo" as it does not update properly inside this callback
727
727
  var wo = this.config.widgetOptions;
728
728
  filters = ts.filter.setDefaults(table, c, wo) || [];
@@ -762,11 +762,9 @@ ts.filter = {
762
762
  var wo = c.widgetOptions,
763
763
  count = 0,
764
764
  completed = function(){
765
- // set initializing false first so findRows will process
766
- wo.filter_initializing = false;
767
- ts.filter.findRows(c.table, c.$table.data('lastSearch'), null);
768
765
  wo.filter_initialized = true;
769
766
  c.$table.trigger('filterInit', c);
767
+ ts.filter.findRows(c.table, c.$table.data('lastSearch'), null);
770
768
  };
771
769
  $.each( wo.filter_formatterInit, function(i, val) {
772
770
  if (val === 1) {
@@ -1095,7 +1093,7 @@ ts.filter = {
1095
1093
  return columns;
1096
1094
  },
1097
1095
  findRows: function(table, filters, combinedFilters) {
1098
- if (table.config.lastCombinedFilter === combinedFilters || table.config.widgetOptions.filter_initializing) { return; }
1096
+ if (table.config.lastCombinedFilter === combinedFilters || !table.config.widgetOptions.filter_initialized) { return; }
1099
1097
  var len, $rows, rowIndex, tbodyIndex, $tbody, $cells, $cell, columnIndex,
1100
1098
  childRow, lastSearch, hasSelect, matches, result, showRow, time, val, indx,
1101
1099
  notFiltered, searchFiltered, filterMatched, excludeMatch, fxn, ffxn,
@@ -1527,7 +1525,7 @@ ts.filter = {
1527
1525
  };
1528
1526
 
1529
1527
  ts.getFilters = function(table, getRaw, setFilters, skipFirst) {
1530
- var i, f, $filters, $column, cols,
1528
+ var i, $filters, $column, cols,
1531
1529
  filters = false,
1532
1530
  c = table ? $(table)[0].config : '',
1533
1531
  wo = c ? c.widgetOptions : '';
@@ -1,4 +1,4 @@
1
- /* Column Selector/Responsive table widget (beta) for TableSorter - 10/26/2014 (v2.18.0)
1
+ /* Column Selector/Responsive table widget (beta) for TableSorter - 11/3/2014 (v2.18.1)
2
2
  * Requires tablesorter v2.8+ and jQuery 1.7+
3
3
  * by Justin Hallett & Rob Garrison
4
4
  */
@@ -120,7 +120,6 @@ tsColSel = ts.columnSelector = {
120
120
  if (wo.columnSelector_mediaquery) {
121
121
  // used by window resize function
122
122
  colSel.lastIndex = -1;
123
- wo.columnSelector_breakpoints.sort();
124
123
  tsColSel.updateBreakpoints(c, wo);
125
124
  c.$table
126
125
  .off('updateAll' + namespace)
@@ -1,4 +1,4 @@
1
- /*! tablesorter CSS Sticky Headers widget - updated 10/26/2014 (v2.18.0)
1
+ /*! tablesorter CSS Sticky Headers widget - updated 11/3/2014 (v2.18.1)
2
2
  * Requires a modern browser, tablesorter v2.8+
3
3
  */
4
4
  /*jshint jquery:true, unused:false */
@@ -19,6 +19,7 @@
19
19
  },
20
20
  init : function(table, thisWidget, c, wo) {
21
21
  var isIE = 'ActiveXObject' in window, // target all versions of IE
22
+ isFF = navigator.userAgent.toLowerCase().indexOf('firefox') > -1,
22
23
  $table = c.$table,
23
24
  $attach = $(wo.cssStickyHeaders_attachTo),
24
25
  namespace = c.namespace + 'cssstickyheader ',
@@ -26,45 +27,66 @@
26
27
  $caption = $table.children('caption'),
27
28
  $win = $attach.length ? $attach : $(window),
28
29
  $parent = $table.parent().closest('table.' + ts.css.table),
29
- $parentThead = $parent.length && ts.hasWidget($parent[0], 'cssStickyHeaders') ? $parent.children('thead') : [];
30
+ $parentThead = $parent.length && ts.hasWidget($parent[0], 'cssStickyHeaders') ? $parent.children('thead') : [],
31
+ lastCaptionSetting = wo.cssStickyHeaders_addCaption;
30
32
 
31
33
  $win
32
34
  .unbind('scroll resize '.split(' ').join(namespace))
33
35
  .bind('scroll resize '.split(' ').join(namespace), function() {
36
+ // make sure "wo" is current otherwise changes to widgetOptions
37
+ // are not dynamic (like the add caption button in the demo)
38
+ wo = c.widgetOptions;
34
39
  var top = $attach.length ? $attach.offset().top : $win.scrollTop(),
35
40
  // add caption height; include table padding top & border-spacing or text may be above the fold (jQuery UI themes)
36
41
  // border-spacing needed in Firefox, but not webkit... not sure if I should account for that
37
- captionHeight = wo.cssStickyHeaders_addCaption ? ( $caption.outerHeight(true) || 0 ) +
38
- ( parseInt( $table.css('padding-top'), 10 ) || 0 ) + ( parseInt( $table.css('border-spacing'), 10 ) || 0 ) : 0,
42
+ captionHeight = ( $caption.outerHeight(true) || 0 ) +
43
+ ( parseInt( $table.css('padding-top'), 10 ) || 0 ) +
44
+ ( parseInt( $table.css('border-spacing'), 10 ) || 0 ),
45
+
46
+ bottom = $table.height() - $thead.height() - ( $table.children('tfoot').height() || 0 ) - ( wo.cssStickyHeaders_addCaption ? captionHeight : 0 ),
47
+
48
+ parentTheadHeight = $parentThead.length ? $parentThead.height() : 0,
39
49
 
40
- bottom = $table.height() - $thead.height() - ( $table.children('tfoot').height() || 0 ) - captionHeight,
41
50
  // get bottom of nested sticky headers
42
- nestedStickyTop = $parentThead.length ? ( isIE ? $parent.data('cssStickyHeaderTop') : $parentThead.offset().top ) +
43
- $parentThead.height() - $win.scrollTop() : 0,
51
+ nestedStickyBottom = $parentThead.length ? (
52
+ isIE ? $parent.data('cssStickyHeaderBottom') + parentTheadHeight :
53
+ $parentThead.offset().top + parentTheadHeight - $win.scrollTop()
54
+ ) : 0,
44
55
 
45
56
  // Detect nested tables - fixes #724
46
- deltaY = top - $table.offset().top + nestedStickyTop + ( parseInt( $table.css('border-top-width'), 10 ) || 0 ) +
57
+ deltaY = top - $table.offset().top + nestedStickyBottom +
58
+ ( parseInt( $table.css('border-top-width'), 10 ) || 0 ) +
59
+ ( wo.cssStickyHeaders_offset || 0 ) +
47
60
  // Again, I dislike browser sniffing... but I have no idea why I need to include a captionHeight
48
61
  // for Firefox here and not for Chrome. Even IE behaves, sorta!
49
- ( wo.cssStickyHeaders_offset || 0 ) + ( navigator.userAgent.toLowerCase().indexOf('firefox') > -1 ? captionHeight : 0 ),
62
+ ( wo.cssStickyHeaders_addCaption ? ( isFF ? captionHeight : 0 ) : -captionHeight ),
50
63
 
51
64
  finalY = deltaY > 0 && deltaY <= bottom ? deltaY : 0,
52
65
 
53
66
  // All IE (even IE11) can only transform header cells - fixes #447 thanks to @gakreol!
54
67
  $cells = isIE ? $thead.children().children() : $thead;
55
68
 
56
- // more crazy IE stuff.. somehow the second nested table is completely ignored
69
+ // more crazy IE stuff...
57
70
  if (isIE) {
58
- c.$table.data('cssStickyHeaderTop', finalY - ( $parentThead.length ? $parentThead.height() : 0 ));
59
- if ($parentThead.length) {
60
- top = $parent.data('cssStickyHeaderTop') - $parentThead.height();
61
- finalY = top > 0 && top <= bottom ? top : 0;
62
- }
71
+ // I didn't bother testing 3 nested tables deep in IE, because I hate it
72
+ c.$table.data( 'cssStickyHeaderBottom', ( $parentThead.length ? parentTheadHeight : 0 ) -
73
+ ( wo.cssStickyHeaders_addCaption ? captionHeight : 0 ) );
63
74
  }
64
75
 
65
76
  if (wo.cssStickyHeaders_addCaption) {
66
77
  $cells = $cells.add($caption);
67
78
  }
79
+ if (lastCaptionSetting !== wo.cssStickyHeaders_addCaption) {
80
+ lastCaptionSetting = wo.cssStickyHeaders_addCaption;
81
+ // reset caption position if addCaption option is dynamically changed to false
82
+ if (!lastCaptionSetting) {
83
+ $caption.css({
84
+ 'transform' : '',
85
+ '-ms-transform' : '',
86
+ '-webkit-transform' : ''
87
+ });
88
+ }
89
+ }
68
90
 
69
91
  $cells.css({
70
92
  'transform' : finalY === 0 ? '' : 'translate(0px,' + finalY + 'px)',
@@ -1,4 +1,4 @@
1
- /* Pager widget for TableSorter 10/26/2014 (v2.18.0) - requires jQuery 1.7+ */
1
+ /* Pager widget for TableSorter 11/3/2014 (v2.18.1) - requires jQuery 1.7+ */
2
2
  /*jshint browser:true, jquery:true, unused:false */
3
3
  ;(function($){
4
4
  "use strict";
@@ -159,12 +159,7 @@ tsp = ts.pager = {
159
159
  p.totalRows = c.$tbodies.eq(0).children('tr').not( wo.pager_countChildRows ? '' : '.' + c.cssChildRow ).length;
160
160
  p.oldAjaxSuccess = p.oldAjaxSuccess || wo.pager_ajaxObject.success;
161
161
  c.appender = tsp.appender;
162
- if (ts.filter && $.inArray('filter', c.widgets) >= 0) {
163
- // get any default filter settings (data-value attribute) fixes #388
164
- p.currentFilters = c.$table.data('lastSearch') || [];
165
- // set, but don't apply current filters
166
- ts.setFilters(table, p.currentFilters, false);
167
- }
162
+ p.initializing = true;
168
163
  if (wo.pager_savePages && ts.storage) {
169
164
  t = ts.storage(table, wo.pager_storageKey) || {}; // fixes #387
170
165
  p.page = isNaN(t.page) ? p.page : t.page;
@@ -173,7 +168,7 @@ tsp = ts.pager = {
173
168
  }
174
169
 
175
170
  // skipped rows
176
- p.regexRows = new RegExp('(' + (wo.filter_filteredRow || 'filtered') + '|' + c.selectorRemove.replace(/^(\w+\.)/g,'') + '|' + c.cssChildRow + ')');
171
+ p.regexRows = new RegExp('(' + (wo.filter_filteredRow || 'filtered') + '|' + c.selectorRemove.slice(1) + '|' + c.cssChildRow + ')');
177
172
 
178
173
  // clear initialized flag
179
174
  p.initialized = false;
@@ -209,9 +204,13 @@ tsp = ts.pager = {
209
204
 
210
205
  // pager initialized
211
206
  p.initialized = true;
207
+ p.initializing = false;
212
208
  p.isInitializing = false;
213
209
  c.$table.trigger('pagerInitialized', c);
214
- tsp.updatePageDisplay(table, c);
210
+ // filter widget not initialized; it will update the output display & fire off the pagerComplete event
211
+ if ( !( c.widgetOptions.filter_initialized && ts.hasWidget(table, 'filter') ) ) {
212
+ tsp.updatePageDisplay(table, c, false);
213
+ }
215
214
  },
216
215
 
217
216
  bindEvents: function(table, c){
@@ -221,23 +220,23 @@ tsp = ts.pager = {
221
220
  s = wo.pager_selectors;
222
221
 
223
222
  c.$table
224
- .off('filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet '.split(' ').join('.pager '))
225
- .on('filterStart.pager', function(e, filters) {
226
- p.currentFilters = filters;
227
- // don't change page is filters are the same (pager updating, etc)
228
- if (wo.pager_pageReset !== false && (c.lastCombinedFilter || '') !== (filters || []).join('')) {
223
+ .off('filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet '.split(' ').join('.pager '))
224
+ .on('filterInit.pager filterStart.pager', function() {
225
+ p.currentFilters = c.$table.data('lastSearch');
226
+ // don't change page if filters are the same (pager updating, etc)
227
+ if (wo.pager_pageReset !== false && (c.lastCombinedFilter || '') !== (p.currentFilters || []).join('')) {
229
228
  p.page = wo.pager_pageReset; // fixes #456 & #565
230
229
  }
231
230
  })
232
231
  // update pager after filter widget completes
233
232
  .on('filterEnd.pager sortEnd.pager', function() {
234
- if (p.initialized) {
233
+ p.currentFilters = c.$table.data('lastSearch');
234
+ if (p.initialized || p.initializing) {
235
235
  if (c.delayInit && c.rowsCopy && c.rowsCopy.length === 0) {
236
236
  // make sure we have a copy of all table rows once the cache has been built
237
237
  tsp.updateCache(table);
238
238
  }
239
239
  // tsp.moveToPage(table, p, false); <-- called when applyWidgets is triggered
240
- c.pager.last.page = -1;
241
240
  c.$table.trigger('applyWidgets');
242
241
  tsp.updatePageDisplay(table, c, false);
243
242
  }
@@ -372,6 +371,7 @@ tsp = ts.pager = {
372
371
  },
373
372
 
374
373
  updatePageDisplay: function(table, c, completed) {
374
+ if ( c.pager.initializing ) { return; }
375
375
  var s, t, $out,
376
376
  wo = c.widgetOptions,
377
377
  p = c.pager,
@@ -554,7 +554,7 @@ tsp = ts.pager = {
554
554
  } else {
555
555
  rows[i].style.display = ( j >= s && j < e ) ? '' : 'none';
556
556
  // don't count child rows
557
- j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.replace(/^(\w+\.)/g,'')) && !wo.pager_countChildRows ? 0 : 1;
557
+ j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.slice(1)) && !wo.pager_countChildRows ? 0 : 1;
558
558
  if ( j === e && rows[i].style.display !== 'none' && rows[i].className.match(ts.css.cssHasChild) ) {
559
559
  lastIndex = i;
560
560
  }
@@ -682,6 +682,7 @@ tsp = ts.pager = {
682
682
  p.last.totalRows = p.totalRows;
683
683
  p.last.currentFilters = p.currentFilters;
684
684
  p.last.sortList = (c.sortList || []).join(',');
685
+ p.initializing = false;
685
686
  tsp.updatePageDisplay(table, c);
686
687
  $t.trigger('updateCache', [function(){
687
688
  if (p.initialized) {
@@ -714,6 +715,7 @@ tsp = ts.pager = {
714
715
  $doc.off('ajaxError.pager');
715
716
  });
716
717
  counter = ++p.ajaxCounter;
718
+ p.last.ajaxUrl = url; // remember processed url
717
719
  p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
718
720
  p.ajaxObject.success = function(data, status, jqxhr) {
719
721
  // Refuse to process old ajax commands that were overwritten by new ones - see #443
@@ -887,10 +889,15 @@ tsp = ts.pager = {
887
889
  var pg, c = table.config,
888
890
  wo = c.widgetOptions,
889
891
  l = p.last;
892
+
893
+ // abort page move if the table has filters and has not been initialized
894
+ if (p.ajax && !wo.filter_initialized && ts.hasWidget(table, 'filter')) { return; }
895
+
890
896
  tsp.calcFilters(table, c);
891
897
  pg = Math.min( p.totalPages, p.filteredPages );
892
898
  if ( p.page < 0 ) { p.page = 0; }
893
899
  if ( p.page > ( pg - 1 ) && pg !== 0 ) { p.page = pg - 1; }
900
+
894
901
  // fixes issue where one current filter is [] and the other is ['','',''],
895
902
  // making the next if comparison think the filters as different. Fixes #202.
896
903
  l.currentFilters = (l.currentFilters || []).join('') === '' ? [] : l.currentFilters;
@@ -978,7 +985,7 @@ tsp = ts.pager = {
978
985
  c.appender = null; // remove pager appender function
979
986
  p.initialized = false;
980
987
  delete table.config.rowsCopy;
981
- c.$table.off('destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager');
988
+ c.$table.off('filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet '.split(' ').join('.pager '));
982
989
  if (ts.storage) {
983
990
  ts.storage(table, c.widgetOptions.pager_storageKey, '');
984
991
  }
@@ -1045,7 +1052,7 @@ ts.showError = function(table, message){
1045
1052
  })
1046
1053
  // add error row to thead instead of tbody, or clicking on the header will result in a parser error
1047
1054
  .appendTo( c.$table.find('thead:first') )
1048
- .addClass( errorRow + ' ' + c.selectorRemove.replace(/^(\w+\.)/g,'') )
1055
+ .addClass( errorRow + ' ' + c.selectorRemove.slice(1) )
1049
1056
  .attr({
1050
1057
  role : 'alert',
1051
1058
  'aria-live' : 'assertive'
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.13.0
4
+ version: 1.13.1
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-10-27 00:00:00.000000000 Z
12
+ date: 2014-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  version: '0'
151
151
  requirements: []
152
152
  rubyforge_project:
153
- rubygems_version: 2.2.2
153
+ rubygems_version: 2.4.2
154
154
  signing_key:
155
155
  specification_version: 4
156
156
  summary: Simple integration of jquery-tablesorter (Mottie's fork) into the Rails asset