jquery-tablesorter 1.10.10 → 1.11.0

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.
@@ -10,9 +10,9 @@
10
10
 
11
11
  Resizable scroller widget for the jQuery tablesorter plugin
12
12
 
13
- Version 2.0 - modified by Rob Garrison (4/12/2013)
14
- Requires jQuery, v1.2.3 or higher
15
- Requires the tablesorter plugin, v2.0 or higher, available at http://mottie.github.com/tablesorter/docs/
13
+ Version 2.0 - modified by Rob Garrison (4/12/2013; updated 4/20/2014 for tablesorter v2.16.0)
14
+ Requires jQuery v1.7+
15
+ Requires the tablesorter plugin, v2.8+, available at http://mottie.github.com/tablesorter/docs/
16
16
 
17
17
  Usage:
18
18
 
@@ -76,7 +76,7 @@ ts.addWidget({
76
76
  //Setup window.resizeEnd event
77
77
  $win
78
78
  .bind('resize', ts.window_resize)
79
- .bind('resizeEnd', function(e) {
79
+ .bind('resizeEnd', function() {
80
80
  // init is run before format, so scroller_resizeWidth
81
81
  // won't be defined within the "c" or "wo" parameters
82
82
  if (typeof table.config.widgetOptions.scroller_resizeWidth === 'function') {
@@ -91,9 +91,7 @@ ts.addWidget({
91
91
  format: function(table, c, wo) {
92
92
  var h, $hdr, id, t, resize, $cells,
93
93
  $win = $(window),
94
- $tbl = c.$table,
95
- flag = false,
96
- filterInputs = 'input, select';
94
+ $tbl = c.$table;
97
95
 
98
96
  if (!c.isScrolling) {
99
97
  h = wo.scroller_height || 300;
@@ -109,11 +107,7 @@ ts.addWidget({
109
107
 
110
108
  $cells = $hdr
111
109
  .wrap('<div class="tablesorter-scroller-header" style="width:' + $tbl.width() + ';" />')
112
- .find('.' + ts.css.header)
113
- .bind('mousedown', function(){
114
- this.onselectstart = function(){ return false; };
115
- return false;
116
- });
110
+ .find('.' + ts.css.header);
117
111
 
118
112
  $tbl
119
113
  .wrap('<div class="tablesorter-scroller-table" style="height:' + h + 'px;width:' + $tbl.width() + ';overflow-y:scroll;" />')
@@ -134,39 +128,12 @@ ts.addWidget({
134
128
  });
135
129
 
136
130
  // make scroller header sortable
137
- c.$headers.find(c.selectorSort).add( c.$headers.filter(c.selectorSort) ).each(function(i){
138
- var t = $(this);
139
- $cells.eq(i)
140
- // clicking on new header will trigger a sort
141
- .bind('mouseup', function(e){
142
- t.trigger(e, true); // external mouseup flag (click timer is ignored)
143
- })
144
- // prevent header text selection
145
- .bind('mousedown', function(){
146
- this.onselectstart = function(){ return false; };
147
- return false;
148
- });
149
- });
131
+ ts.bindEvents(table, $cells);
150
132
 
151
133
  // look for filter widget
152
- $tbl.bind('filterEnd', function(){
153
- if (flag) { return; }
154
- $cells.each(function(i){
155
- $(this).find(filterInputs).val( c.$filters.find(filterInputs).eq(i).val() );
156
- });
157
- });
158
- $hdr.find(filterInputs).bind('keyup search', function(e){
159
- // ignore arrow and meta keys; allow backspace
160
- if ((e.which < 32 && e.which !== 8) || (e.which >= 37 && e.which <=40)) { return; }
161
- flag = true;
162
- var $f = $(this), col = $f.attr('data-column');
163
- c.$filters.find(filterInputs).eq(col)
164
- .val( $f.val() )
165
- .trigger('search');
166
- setTimeout(function(){
167
- flag = false;
168
- }, wo.filter_searchDelay);
169
- });
134
+ if ($tbl.hasClass('hasFilters')) {
135
+ ts.filter.bindSearch( $tbl, $cells.find('.' + ts.css.filter) );
136
+ }
170
137
 
171
138
  resize = function(){
172
139
  var d,
@@ -234,8 +201,14 @@ ts.addWidget({
234
201
 
235
202
  },
236
203
  remove : function(table, c, wo){
237
-
204
+ var $table = c.$table;
205
+ $table.closest('.tablesorter-scroller').find('.tablesorter-scroller-header').remove();
206
+ $table
207
+ .unwrap()
208
+ .find('.tablesorter-filter-row').removeClass('hideme').end()
209
+ .find('thead').show().css('visibility', 'visible');
210
+ c.isScrolling = false;
238
211
  }
239
- });
212
+ });
240
213
 
241
214
  })(jQuery);
@@ -0,0 +1,123 @@
1
+ /*
2
+ * StaticRow widget for jQuery TableSorter 2.0
3
+ * Version 1.1 - modified by Rob Garrison (4/22/2014 for tablesorter v2.16.1-beta)
4
+ * Requires:
5
+ * jQuery v1.4+
6
+ * tablesorter plugin, v2.8+, available at http://mottie.github.com/tablesorter/docs/
7
+ *
8
+ * Copyright (c) 2011 Nils Luxton
9
+ * Licensed under the MIT license:
10
+ * http://www.opensource.org/licenses/mit-license.php
11
+ *
12
+ */
13
+ /*jshint browser:true, jquery:true, unused:false */
14
+ /*global jQuery: false */
15
+ ;(function($){
16
+ "use strict";
17
+ var ts = $.tablesorter,
18
+
19
+ // events triggered on the table that update this widget
20
+ events = 'staticRowsRefresh updateComplete '.split(' ').join('.tsstaticrows '),
21
+
22
+ // add/refresh row indexes
23
+ addIndexes = function(table){
24
+ var $tr, wo, v, indx, rows,
25
+ c = table.config;
26
+ // "Index" the static rows, saving their current (starting) position in the
27
+ // table inside a data() param on the <tr> element itself for later use.
28
+ if (c) {
29
+ wo = c.widgetOptions;
30
+ c.$tbodies.each(function(){
31
+ $tr = $(this).children();
32
+ rows = $tr.length;
33
+ $tr.filter(wo.staticRow_class).each(function() {
34
+ $tr = $(this);
35
+ indx = $tr.data(wo.staticRow_index);
36
+ if (typeof indx !== "undefined") {
37
+ v = parseFloat(indx);
38
+ // percentage of total rows
39
+ indx = (/%/.test(indx)) ? Math.round(v/100 * rows) : v;
40
+ } else {
41
+ indx = $tr.index();
42
+ }
43
+ // row indexing starts over within each tbody
44
+ $tr.data( wo.staticRow_data, indx );
45
+ });
46
+ });
47
+ }
48
+ };
49
+
50
+ ts.addWidget({
51
+ // Give the new Widget an ID to be used in the tablesorter() call, as follows:
52
+ // $('#myElement').tablesorter({ widgets: ['zebra', 'staticRow'] });
53
+ id: 'staticRow',
54
+
55
+ options: {
56
+ staticRow_class : '.static',
57
+ staticRow_data : 'static-index',
58
+ staticRow_index : 'row-index'
59
+ },
60
+
61
+ init: function(table, thisWidget, c, wo){
62
+ addIndexes(table);
63
+ // refresh static rows after updates
64
+ c.$table
65
+ .unbind(events)
66
+ .bind(events, function(){
67
+ addIndexes(table);
68
+ c.$table.trigger('applyWidgets');
69
+ });
70
+ },
71
+
72
+ format: function(table, c, wo) {
73
+ // Loop thru static rows, moving them to their original "indexed" position,
74
+ // & repeat until no more re-shuffling is needed
75
+ var targetIndex, $thisRow, indx, numRows, $tbody, hasShuffled, $rows, max;
76
+ c.$tbodies.each(function(){
77
+ $tbody = $(this);
78
+ hasShuffled = true;
79
+ indx = 0;
80
+ $rows = $tbody.children(wo.staticRow_class);
81
+ numRows = $tbody.children('tr').length - 1;
82
+ max = $rows.length;
83
+
84
+ // don't allow the while loop to cycle more times than the set number of static rows
85
+ while (hasShuffled && indx < max) {
86
+ hasShuffled = false;
87
+
88
+ /*jshint loopfunc:true */
89
+ $rows.each(function() {
90
+ targetIndex = $(this).data(wo.staticRow_data);
91
+ // allow setting target index >> num rows to always make a row last
92
+ targetIndex = targetIndex >= numRows ? numRows : targetIndex < 0 ? 0 : targetIndex;
93
+ if (targetIndex !== $(this).index()) {
94
+ hasShuffled = true;
95
+ $thisRow = $(this).detach();
96
+
97
+ if (targetIndex >= numRows) {
98
+ // Are we trying to be the last row?
99
+ $thisRow.appendTo( $tbody );
100
+ } else if (targetIndex === 0) {
101
+ // Are we trying to be the first row?
102
+ $thisRow.prependTo( $tbody );
103
+ } else {
104
+ // No, we want to be somewhere in the middle!
105
+ $thisRow.insertBefore( $tbody.find('tr:eq(' + targetIndex + ')') );
106
+ }
107
+ }
108
+ });
109
+ indx++;
110
+
111
+ }
112
+
113
+ });
114
+ c.$table.trigger('staticRowsComplete', table);
115
+ },
116
+
117
+ remove : function(table, c, wo){
118
+ c.$table.unbind(events);
119
+ }
120
+
121
+ });
122
+
123
+ })(jQuery);
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.10.10
4
+ version: 1.11.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: 2014-04-10 00:00:00.000000000 Z
12
+ date: 2014-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -73,8 +73,10 @@ files:
73
73
  - vendor/assets/javascripts/jquery-tablesorter/extras/semver.js
74
74
  - vendor/assets/javascripts/jquery-tablesorter/jquery.metadata.js
75
75
  - vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js
76
+ - vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets-filter-formatter-select2.js
76
77
  - vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets-filter-formatter.js
77
78
  - vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js
79
+ - vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-extract.js
78
80
  - vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-iso8601.js
79
81
  - vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
80
82
  - vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-two-digit-year.js
@@ -93,9 +95,13 @@ files:
93
95
  - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-editable.js
94
96
  - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-grouping.js
95
97
  - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-headerTitles.js
98
+ - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-math.js
99
+ - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-output.js
96
100
  - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js
101
+ - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-reflow.js
97
102
  - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-repeatheaders.js
98
103
  - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-scroller.js
104
+ - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-staticRow.js
99
105
  - vendor/assets/stylesheets/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.css
100
106
  - vendor/assets/stylesheets/jquery-tablesorter/filter.formatter.css
101
107
  - vendor/assets/stylesheets/jquery-tablesorter/theme.black-ice.css