jquery-tablesorter 1.13.4 → 1.14.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +2 -2
  4. data/lib/jquery-tablesorter/version.rb +1 -1
  5. data/vendor/assets/images/jquery-tablesorter/dragtable-handle.png +0 -0
  6. data/vendor/assets/images/jquery-tablesorter/dragtable-handle.svg +7 -0
  7. data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +58 -32
  8. data/vendor/assets/javascripts/jquery-tablesorter/extras/jquery.dragtable.mod.js +605 -0
  9. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +161 -81
  10. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets-filter-formatter-select2.js +41 -30
  11. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +151 -96
  12. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-duration.js +32 -5
  13. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-input-select.js +21 -26
  14. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-alignChar.js +5 -4
  15. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-build-table.js +2 -2
  16. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-chart.js +276 -0
  17. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columnSelector.js +64 -32
  18. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-cssStickyHeaders.js +3 -2
  19. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-editable.js +11 -5
  20. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-formatter.js +70 -0
  21. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-math.js +13 -6
  22. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-output.js +7 -3
  23. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +70 -41
  24. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-print.js +2 -2
  25. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-reflow.js +4 -3
  26. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-repeatheaders.js +14 -12
  27. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-scroller.js +68 -26
  28. data/vendor/assets/stylesheets/jquery-tablesorter/dragtable.mod.css +64 -0
  29. data/vendor/assets/stylesheets/jquery-tablesorter/theme.black-ice.css +3 -0
  30. data/vendor/assets/stylesheets/jquery-tablesorter/theme.blue.css +3 -0
  31. data/vendor/assets/stylesheets/jquery-tablesorter/theme.bootstrap.css +3 -0
  32. data/vendor/assets/stylesheets/jquery-tablesorter/theme.bootstrap_2.css +3 -0
  33. data/vendor/assets/stylesheets/jquery-tablesorter/theme.dark.css +3 -0
  34. data/vendor/assets/stylesheets/jquery-tablesorter/theme.default.css +3 -0
  35. data/vendor/assets/stylesheets/jquery-tablesorter/theme.dropbox.css +3 -0
  36. data/vendor/assets/stylesheets/jquery-tablesorter/theme.green.css +3 -0
  37. data/vendor/assets/stylesheets/jquery-tablesorter/theme.grey.css +3 -0
  38. data/vendor/assets/stylesheets/jquery-tablesorter/theme.ice.css +3 -0
  39. data/vendor/assets/stylesheets/jquery-tablesorter/theme.jui.css +3 -0
  40. data/vendor/assets/stylesheets/jquery-tablesorter/theme.metro-dark.css +3 -0
  41. metadata +8 -2
@@ -1,18 +1,17 @@
1
1
  /*! input & select parsers for jQuery 1.7+ & tablesorter 2.7.11+
2
- * Updated 9/15/2014 (v2.17.8)
2
+ * Updated 2/7/2015 (v2.19.0)
3
3
  * Demo: http://mottie.github.com/tablesorter/docs/example-widget-grouping.html
4
4
  */
5
5
  /*jshint browser: true, jquery:true, unused:false */
6
6
  ;(function($){
7
7
  "use strict";
8
8
 
9
- var resort = true, // resort table after update
10
- updateServer = function(event, $table, $input){
11
- // do something here to update your server, if needed
12
- // event = change event object
13
- // $table = jQuery object of the table that was just updated
14
- // $input = jQuery object of the input or select that was modified
15
- };
9
+ var updateServer = function(event, $table, $input){
10
+ // do something here to update your server, if needed
11
+ // event = change event object
12
+ // $table = jQuery object of the table that was just updated
13
+ // $input = jQuery object of the input or select that was modified
14
+ };
16
15
 
17
16
  // Custom parser for parsing input values
18
17
  // updated dynamically using the "change" function below
@@ -98,26 +97,21 @@
98
97
  // if this code interferes somehow, target the specific table $('#mytable'), instead of $('table')
99
98
  $(function(){
100
99
  $('table').on('tablesorter-initialized', function(){
101
- // this flag prevents the updateCell event from being spammed
102
- // it happens when you modify input text and hit enter
103
- var focused = false,
104
- restoreValue = function(isTbody){
105
- // focused = false; // uncomment this line to prevent auto-accepting changes
106
- // make sure we restore original values
107
- // isTbody is needed to prevent the select from closing in IE
108
- // see https://connect.microsoft.com/IE/feedbackdetail/view/962618/
109
- if (isTbody) {
110
- $(':focus').blur();
111
- }
112
- return;
113
- };
100
+ var restoreValue = function(isTbody){
101
+ // make sure we restore original values (trigger blur)
102
+ // isTbody is needed to prevent the select from closing in IE
103
+ // see https://connect.microsoft.com/IE/feedbackdetail/view/962618/
104
+ if (isTbody) {
105
+ $(':focus').blur();
106
+ }
107
+ return;
108
+ };
114
109
  // bind to .tablesorter (default class name)
115
110
  $(this).children('tbody')
116
111
  .on('mouseleave', function(e){
117
112
  restoreValue(e.target.tagName === 'TBODY');
118
113
  })
119
114
  .on('focus', 'select, input, textarea', function(){
120
- focused = true;
121
115
  $(this).data('ts-original-value', this.value);
122
116
  })
123
117
  .on('blur', 'input, textarea', function(){
@@ -132,9 +126,10 @@
132
126
  return;
133
127
  }
134
128
  // Update cell cache using... select: change, input: enter or textarea: alt + enter
135
- if ( ( e.type === 'change' && focused ) ||
129
+ if ( ( e.type === 'change' ) ||
136
130
  ( e.type === 'keyup' && e.which === 13 && ( e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' && e.altKey ) ) ) {
137
- var $tar = $(e.target),
131
+ var undef,
132
+ $tar = $(e.target),
138
133
  $cell = $tar.closest('td'),
139
134
  $table = $cell.closest('table'),
140
135
  indx = $cell[0].cellIndex,
@@ -148,9 +143,9 @@
148
143
  // ignore change event if nothing changed
149
144
  if ($tar.val() !== $tar.data('ts-original-value')) {
150
145
  $tar.data('ts-original-value', $tar.val());
151
- $table.trigger('updateCell', [ $tar.closest('td'), resort, function(){
146
+ // pass undefined resort value so it falls back to config.resort setting
147
+ $table.trigger('updateCell', [ $tar.closest('td'), undef, function(){
152
148
  updateServer(e, $table, $tar);
153
- setTimeout(function(){ focused = false; }, 10);
154
149
  } ]);
155
150
  }
156
151
  }
@@ -1,4 +1,4 @@
1
- /*! tablesorter Align Character widget - updated 3/12/2014 (core v2.15.8)
1
+ /*! tablesorter Align Character widget - updated 2/7/2015 (v2.19.0)
2
2
  * Requires tablesorter v2.8+ and jQuery 1.7+
3
3
  * by Rob Garrison
4
4
  */
@@ -83,10 +83,10 @@ ts.alignChar = {
83
83
  for (rowIndex = 0; rowIndex < len; rowIndex++) {
84
84
  alignChar = $(wo.alignChar_wrap).length ? $(wo.alignChar_wrap).html(v.align)[0].outerHTML : v.align;
85
85
  $row = rows.row ? rows.row[rowIndex] : rows.normalized[rowIndex][c.columns].$row;
86
+ last = right[rowIndex].slice(v.align.length);
86
87
  $row.find('td').eq(v.column).html(
87
88
  '<span class="ts-align-wrap"><span class="ts-align-left" style="' + wLeft + '">' + left[rowIndex] + '</span>' +
88
- '<span class="ts-align-right" style="' + wRight + '">' + alignChar +
89
- right[rowIndex].slice(v.align.length) + '</span></span>'
89
+ '<span class="ts-align-right" style="' + wRight + '">' + ( last.length ? alignChar + last : '' ) + '</span></span>'
90
90
  );
91
91
  }
92
92
  }
@@ -134,7 +134,8 @@ ts.addWidget({
134
134
  c.$table.trigger('refreshAlign');
135
135
  }
136
136
  },
137
- remove : function(table, c, wo){
137
+ remove : function(table, c, wo, refreshing){
138
+ if (refreshing) { return; }
138
139
  c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function(){
139
140
  ts.alignChar.remove(table, c, this.column);
140
141
  });
@@ -1,4 +1,4 @@
1
- /*! Build Table widget for tableSorter v2.16.0 (4/23/2014)
1
+ /*! Build Table widget for tableSorter v2.16.0; updated 2/7/2015 (v2.19.0)
2
2
  * by Rob Garrison
3
3
  */
4
4
  /*jshint browser:true, jquery:true, unused:false */
@@ -34,7 +34,7 @@ var ts = $.tablesorter = $.tablesorter || {},
34
34
  return bt.html( table, d, wo );
35
35
  }
36
36
  try {
37
- d = $.parseJSON(d);
37
+ d = $.parseJSON(d || 'null');
38
38
  if (d) {
39
39
  // valid JSON!
40
40
  return bt.object( table, d, wo );
@@ -0,0 +1,276 @@
1
+ /* Chart widget (beta) for TableSorter 2/7/2015 (v2.19.0)
2
+ * Requires tablesorter v2.8+ and jQuery 1.7+
3
+ */
4
+ /*jshint browser:true, jquery:true, unused:false */
5
+ /*global jQuery: false */
6
+ ;(function($){
7
+ 'use strict';
8
+
9
+ var ts = $.tablesorter,
10
+
11
+ // temp variables
12
+ chart_cols = [],
13
+ chart_headers = [],
14
+ // google charts
15
+ chart_rows = [],
16
+ chart_data = [],
17
+ // highcharts
18
+ chart_categories = [],
19
+ chart_series = [],
20
+ // fusioncharts
21
+ chart_category = [],
22
+ chart_dataset = [],
23
+
24
+ chart = ts.chart = {
25
+
26
+ // regex used to strip out non-digit values before sending
27
+ // the string to the $.tablesorter.formatFloat function
28
+ nonDigit : /[^\d,.\-()]/g,
29
+
30
+ init: function(c, wo) {
31
+ c.$table
32
+ .off(wo.chart_event)
33
+ .on(wo.chart_event, function() {
34
+ if (this.hasInitialized) {
35
+ // refresh "c" variable in case options are updated dynamically
36
+ var c = this.config;
37
+ chart.getCols(c, c.widgetOptions);
38
+ chart.getData(c, c.widgetOptions);
39
+ }
40
+ });
41
+ },
42
+
43
+ getCols: function(c, wo) {
44
+ var i;
45
+ chart_cols = [];
46
+ chart_series = [];
47
+ chart_dataset = [];
48
+
49
+ for ( i = 0; i < c.columns; i++ ) {
50
+ if ( wo.chart_useSelector && ts.hasWidget( c.table, 'columnSelector' ) && !c.selector.auto ) {
51
+ if ( ( c.selector.states[i] && $.inArray(i, wo.chart_ignoreColumns) < 0 ) ||
52
+ i === wo.chart_labelCol || i === wo.chart_sort[0][0] ) {
53
+ chart_cols.push(i);
54
+ }
55
+ } else {
56
+ if ( $.inArray(i, wo.chart_ignoreColumns) < 0 || i === wo.chart_labelCol || i === wo.chart_sort[0][0] ) {
57
+ chart_cols.push(i);
58
+ }
59
+ }
60
+ }
61
+ },
62
+
63
+ getData: function(c, wo) {
64
+ chart.getHeaders(c, wo);
65
+ chart.getRows(c, wo);
66
+
67
+ /* == Google data ==
68
+ array of arrays (Google charts)
69
+ [
70
+ [ "Year", "Sales", "Expenses" ],
71
+ [ "2004", 1000, 400 ],
72
+ [ "2005", 1170, 460 ],
73
+ [ "2006", 660, 1120 ],
74
+ [ "2007", 1030, 540 ]
75
+ ]
76
+
77
+ == Highcharts ==
78
+ categories -> [ '2004', '2005', '2006', '2007' ]
79
+ series -> [{
80
+ name: 'Sales',
81
+ data: [ 1000, 1170, 660, 1030 ]
82
+ }, {
83
+ name: 'Expenses',
84
+ data: [ 400, 460, 1120, 540 ]
85
+ }]
86
+
87
+ == Fusioncharts
88
+ "categories": [{
89
+ "category": [
90
+ {"label": "2004"},
91
+ {"label": "2005"},
92
+ {"label": "2006"},
93
+ {"label": "2007"}
94
+ ]
95
+ }],
96
+ "dataset": [
97
+ {
98
+ "seriesname": "Sales",
99
+ "data": [
100
+ {"value": "1000"},
101
+ {"value": "1170"},
102
+ {"value": "660"},
103
+ {"value": "1030"}
104
+ ]
105
+ },{
106
+ "seriesname": "Expenses",
107
+ "data": [
108
+ {"value": "400"},
109
+ {"value": "600"},
110
+ {"value": "1120"},
111
+ {"value": "540"}
112
+ ]
113
+ }
114
+ ]
115
+ */
116
+
117
+ chart_data = [ chart_headers ];
118
+ $.each(chart_rows, function(k, row) {
119
+ chart_data.push(row);
120
+ });
121
+
122
+ c.chart = {
123
+ // google
124
+ data: chart_data,
125
+ // highcharts
126
+ categories: chart_categories,
127
+ series: chart_series,
128
+ // FusionCharts
129
+ category: chart_category,
130
+ dataset: chart_dataset
131
+ };
132
+ },
133
+
134
+ getHeaders: function(c, wo) {
135
+ var text;
136
+ chart_headers = [];
137
+ chart_series = [];
138
+ chart_dataset = [];
139
+ chart_headers.push( c.headerContent[wo.chart_labelCol] );
140
+ $.each(chart_cols, function(k, col) {
141
+ if (col === wo.chart_labelCol) {
142
+ return true;
143
+ }
144
+ text = c.headerContent[col];
145
+ chart_headers.push( text );
146
+ chart_series.push( { name: text, data: [] } );
147
+ chart_dataset.push( { seriesname: text, data: [] } );
148
+ });
149
+ },
150
+
151
+ getRows: function(c, wo) {
152
+ // the cache may not have a zero index if there are any "info-only" tbodies above the main tbody
153
+ var cache = c.cache[0].normalized,
154
+ rows = [];
155
+ chart_rows = [];
156
+ chart_categories = [];
157
+ chart_category = [];
158
+
159
+ $.each(cache, function(indx, rowVal) {
160
+ var i, txt,
161
+ $tr = rowVal[c.columns].$row,
162
+ $cells = $tr.children('th,td'),
163
+ row = [];
164
+ if (
165
+ (/v/i.test(wo.chart_incRows) && $tr.is(':visible')) ||
166
+ (/f/i.test(wo.chart_incRows) && !$tr.hasClass(wo.filter_filteredRow || 'filtered')) ||
167
+ (!/(v|f)/i.test(wo.chart_incRows))
168
+ ) {
169
+ // Add all cols (don't mess up indx for sorting)
170
+ for (i = 0; i < c.columns; i++) {
171
+ if ( $.inArray(indx, wo.chart_parsed) >= 0 ) {
172
+ row.push( rowVal[i] );
173
+ } else {
174
+ txt = $cells[i].getAttribute( c.textAttribute ) || $cells[i].textContent || $cells.eq(i).text();
175
+ row.push( $.trim( txt ) );
176
+ }
177
+ }
178
+ rows.push(row);
179
+ }
180
+ });
181
+
182
+ // sort based on chart_sort
183
+ rows.sort(function(a, b) {
184
+ if ( wo.chart_sort[0][1] === 1 ) {
185
+ return ts.sortNatural( b[wo.chart_sort[0][0]], a[wo.chart_sort[0][0]] );
186
+ }
187
+ return ts.sortNatural( a[wo.chart_sort[0][0]], b[wo.chart_sort[0][0]] );
188
+ });
189
+
190
+ $.each(rows, function(i, rowVal) {
191
+ var value,
192
+ objIndex = 0,
193
+ row = [],
194
+ label = rowVal[wo.chart_labelCol];
195
+
196
+ row.push( '' + label );
197
+
198
+ $.each(rowVal, function(indx, cellValue) {
199
+ var tempVal;
200
+ if (indx === wo.chart_labelCol) {
201
+ chart_categories.push( cellValue );
202
+ chart_category.push({ 'label': cellValue });
203
+ return true;
204
+ }
205
+ value = false;
206
+ if ( wo.chart_useSelector && ts.hasWidget( c.table, 'columnSelector' ) && !c.selector.auto ) {
207
+ if ( c.selector.states[indx] && $.inArray(indx, wo.chart_ignoreColumns) < 0 ) {
208
+ value = '' + cellValue;
209
+ }
210
+ } else {
211
+ if ($.inArray(indx, wo.chart_ignoreColumns) < 0) {
212
+ value = '' + cellValue;
213
+ }
214
+ }
215
+
216
+ if (value !== false) {
217
+ if ( /s/i.test( '' + wo.chart_layout[row.length] ) ) {
218
+ row.push( value );
219
+ chart_series[objIndex].data.push( value );
220
+ chart_dataset[objIndex].data.push( value );
221
+ } else {
222
+ // using format float, after stripping out all non-digit values
223
+ tempVal = ts.formatFloat( value.replace( chart.nonDigit, '' ), c.table );
224
+ tempVal = isNaN(tempVal) ? value : tempVal;
225
+ // if tempVal ends up being an empty string, fall back to value
226
+ row.push( tempVal );
227
+ chart_series[objIndex].data.push( tempVal );
228
+ chart_dataset[objIndex].data.push( { value : tempVal } );
229
+ }
230
+ objIndex++;
231
+ }
232
+ });
233
+ chart_rows.push(row);
234
+ });
235
+ },
236
+
237
+ remove: function(c) {
238
+ c.$table.off(chart.event);
239
+ }
240
+
241
+ };
242
+
243
+ ts.addWidget({
244
+ id: 'chart',
245
+ options: {
246
+ // (a)ll, (v)isible or (f)iltered - only the first letter is needed
247
+ chart_incRows: 'filtered',
248
+ // prefer columnSelector for ignoreColumns
249
+ chart_useSelector: false,
250
+ // columns to ignore [0, 1,... ] (zero-based index)
251
+ chart_ignoreColumns: [],
252
+ // Use parsed data instead of cell.text()
253
+ chart_parsed: [],
254
+ // data output layout, float is default
255
+ chart_layout: {
256
+ // first element is a string, all others will be float
257
+ 0: 'string'
258
+ },
259
+ // Set the label column
260
+ chart_labelCol: 0,
261
+ // data sort, should always be first row, might want [[0,1]]
262
+ chart_sort: [[0,0]],
263
+ // event to trigger get updated data
264
+ chart_event: 'chartData'
265
+ },
266
+
267
+ init: function(table, thisWidget, c, wo) {
268
+ chart.init(c, wo);
269
+ },
270
+
271
+ remove: function(table, c, wo) {
272
+ chart.remove(c);
273
+ }
274
+ });
275
+
276
+ })(jQuery);
@@ -1,4 +1,4 @@
1
- /* Column Selector/Responsive table widget (beta) for TableSorter - 12/22/2014 (v2.18.4)
1
+ /* Column Selector/Responsive table widget for TableSorter - 2/7/2015 (v2.19.0)
2
2
  * Requires tablesorter v2.8+ and jQuery 1.7+
3
3
  * by Justin Hallett & Rob Garrison
4
4
  */
@@ -49,11 +49,31 @@ tsColSel = ts.columnSelector = {
49
49
 
50
50
  c.$table
51
51
  .off('refreshColumnSelector' + namespace)
52
- .on('refreshColumnSelector' + namespace, function(){
52
+ .on('refreshColumnSelector' + namespace, function(e, opt){
53
53
  // make sure we're using current config settings
54
- var c = this.config;
55
- tsColSel.updateBreakpoints(c, c.widgetOptions);
56
- tsColSel.updateCols(c, c.widgetOptions);
54
+ var i,
55
+ isArry = $.isArray(opt),
56
+ c = this.config,
57
+ wo = c.widgetOptions;
58
+ // see #798
59
+ if (opt && c.selector.$container.length) {
60
+ if (isArry) {
61
+ // make sure array contains numbers
62
+ $.each(opt, function(i,v){
63
+ opt[i] = parseInt(v, 10);
64
+ });
65
+ for (i = 0; i < c.columns; i++) {
66
+ c.selector.$container
67
+ .find('input[data-column=' + i + ']')
68
+ .prop('checked', $.inArray( i, opt ) >= 0 );
69
+ }
70
+ }
71
+ // if passing an array, set auto to false to allow manual column selection & update columns
72
+ tsColSel.updateAuto( c, wo, colSel.$container.find('input[data-column="auto"]').prop('checked', !isArry) );
73
+ } else {
74
+ tsColSel.updateBreakpoints(c, wo);
75
+ tsColSel.updateCols(c, wo);
76
+ }
57
77
  });
58
78
 
59
79
  },
@@ -91,7 +111,7 @@ tsColSel = ts.columnSelector = {
91
111
  // set default state; storage takes priority
92
112
  colSel.states[colId] = saved && typeof(saved[colId]) !== 'undefined' ?
93
113
  saved[colId] : typeof(wo.columnSelector_columns[colId]) !== 'undefined' ?
94
- wo.columnSelector_columns[colId] : (state === 'true' || !(state === 'false'));
114
+ wo.columnSelector_columns[colId] : (state === 'true' || state !== 'false');
95
115
  colSel.$column[colId] = $(this);
96
116
 
97
117
  // set default col title
@@ -141,29 +161,7 @@ tsColSel = ts.columnSelector = {
141
161
  .prop('checked', colSel.auto)
142
162
  .toggleClass( wo.columnSelector_cssChecked, colSel.auto )
143
163
  .on('change', function(){
144
- colSel.auto = this.checked;
145
- $.each( colSel.$checkbox, function(i, $cb){
146
- if ($cb) {
147
- $cb[0].disabled = colSel.auto;
148
- colSel.$wrapper[i].toggleClass('disabled', colSel.auto);
149
- }
150
- });
151
- if (wo.columnSelector_mediaquery) {
152
- tsColSel.updateBreakpoints(c, wo);
153
- }
154
- tsColSel.updateCols(c, wo);
155
- // copy the column selector to a popup/tooltip
156
- if (c.selector.$popup) {
157
- c.selector.$popup.find('.tablesorter-column-selector')
158
- .html( colSel.$container.html() )
159
- .find('input').each(function(){
160
- var indx = $(this).attr('data-column');
161
- $(this).prop( 'checked', indx === 'auto' ? colSel.auto : colSel.states[indx] );
162
- });
163
- }
164
- if (wo.columnSelector_saveColumns && ts.storage) {
165
- ts.storage( c.$table[0], 'tablesorter-columnSelector-auto', { auto : colSel.auto } );
166
- }
164
+ tsColSel.updateAuto(c, wo, $(this));
167
165
  }).change();
168
166
  }
169
167
  // Add a bind on update to re-run col setup
@@ -173,6 +171,37 @@ tsColSel = ts.columnSelector = {
173
171
  }
174
172
  },
175
173
 
174
+ updateAuto: function(c, wo, $el) {
175
+ var colSel = c.selector;
176
+ colSel.auto = $el.prop('checked') || false;
177
+ $.each( colSel.$checkbox, function(i, $cb){
178
+ if ($cb) {
179
+ $cb[0].disabled = colSel.auto;
180
+ colSel.$wrapper[i].toggleClass('disabled', colSel.auto);
181
+ }
182
+ });
183
+ if (wo.columnSelector_mediaquery) {
184
+ tsColSel.updateBreakpoints(c, wo);
185
+ }
186
+ tsColSel.updateCols(c, wo);
187
+ // copy the column selector to a popup/tooltip
188
+ if (c.selector.$popup) {
189
+ c.selector.$popup.find('.tablesorter-column-selector')
190
+ .html( colSel.$container.html() )
191
+ .find('input').each(function(){
192
+ var indx = $(this).attr('data-column');
193
+ $(this).prop( 'checked', indx === 'auto' ? colSel.auto : colSel.states[indx] );
194
+ });
195
+ }
196
+ if (wo.columnSelector_saveColumns && ts.storage) {
197
+ ts.storage( c.$table[0], 'tablesorter-columnSelector-auto', { auto : colSel.auto } );
198
+ }
199
+ // trigger columnUpdate if auto is true (it gets skipped in updateCols()
200
+ if (colSel.auto) {
201
+ c.$table.trigger('columnUpdate');
202
+ }
203
+ },
204
+
176
205
  updateBreakpoints: function(c, wo) {
177
206
  var priority, column, breaks,
178
207
  colSel = c.selector,
@@ -256,9 +285,11 @@ tsColSel = ts.columnSelector = {
256
285
  $popup.find('.tablesorter-column-selector')
257
286
  .html( colSel.$container.html() )
258
287
  .find('input').each(function(){
259
- var indx = $(this).toggleClass( wo.columnSelector_cssChecked, isChecked ).attr('data-column'),
288
+ var indx = $(this).attr('data-column'),
260
289
  isChecked = indx === 'auto' ? colSel.auto : colSel.states[indx];
261
- $(this).prop( 'checked', isChecked );
290
+ $(this)
291
+ .toggleClass( wo.columnSelector_cssChecked, isChecked )
292
+ .prop( 'checked', isChecked );
262
293
  });
263
294
  colSel.$popup = $popup.on('change', 'input', function(){
264
295
  // data input
@@ -313,7 +344,8 @@ ts.addWidget({
313
344
  init: function(table, thisWidget, c, wo) {
314
345
  tsColSel.init(table, c, wo);
315
346
  },
316
- remove: function(table, c){
347
+ remove: function(table, c, wo, refreshing) {
348
+ if (refreshing) { return; }
317
349
  var csel = c.selector;
318
350
  csel.$container.empty();
319
351
  if (csel.$popup) { csel.$popup.empty(); }