jquery-tablesorter 1.12.8 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/jquery-tablesorter/version.rb +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +115 -67
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +62 -40
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +251 -118
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-extract.js +48 -24
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-iso8601.js +5 -4
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js +16 -10
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-two-digit-year.js +26 -19
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-weekday.js +16 -10
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date.js +7 -4
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-named-numbers.js +121 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/{parser-ipv6.js → parser-network.js} +66 -17
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columnSelector.js +10 -7
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-cssStickyHeaders.js +62 -35
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-editable.js +197 -174
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-grouping.js +3 -6
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +145 -62
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-repeatheaders.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-scroller.js +16 -14
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.black-ice.css +2 -2
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.blue.css +2 -2
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.bootstrap_2.css +2 -2
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.dark.css +2 -2
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.default.css +2 -2
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.dropbox.css +2 -2
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.green.css +2 -2
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.grey.css +2 -2
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.ice.css +2 -2
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.jui.css +4 -1
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.metro-dark.css +4 -4
- metadata +4 -3
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! tablesorter Grouping widget - updated
|
1
|
+
/*! tablesorter Grouping widget - updated 10/26/2014 (v2.18.0)
|
2
2
|
* Requires tablesorter v2.8+ and jQuery 1.7+
|
3
3
|
* by Rob Garrison
|
4
4
|
*/
|
@@ -43,6 +43,7 @@ ts.grouping = {
|
|
43
43
|
hours = time.getHours();
|
44
44
|
return part === 'year' ? time.getFullYear() :
|
45
45
|
part === 'month' ? wo.group_months[time.getMonth()] :
|
46
|
+
part === 'monthyear' ? wo.group_months[time.getMonth()] + ' ' + time.getFullYear() :
|
46
47
|
part === 'day' ? wo.group_months[time.getMonth()] + ' ' + time.getDate() :
|
47
48
|
part === 'week' ? wo.group_week[time.getDay()] :
|
48
49
|
part === 'time' ? ('00' + (hours > 12 ? hours - 12 : hours === 0 ? hours + 12 : hours)).slice(-2) + ':' +
|
@@ -53,7 +54,7 @@ ts.grouping = {
|
|
53
54
|
|
54
55
|
update : function(table, c, wo){
|
55
56
|
if ($.isEmptyObject(c.cache)) { return; }
|
56
|
-
var rowIndex, tbodyIndex, currentGroup, $rows, groupClass, grouping,
|
57
|
+
var rowIndex, tbodyIndex, currentGroup, $rows, groupClass, grouping, cache, saveName, direction,
|
57
58
|
lang = wo.grouping_language,
|
58
59
|
group = '',
|
59
60
|
savedGroup = false,
|
@@ -66,7 +67,6 @@ ts.grouping = {
|
|
66
67
|
c.$table.data('pagerSavedHeight', 0);
|
67
68
|
}
|
68
69
|
if (column >= 0 && !c.$headers.filter('[data-column="' + column + '"]:last').hasClass('group-false')) {
|
69
|
-
if (c.debug){ time = new Date(); }
|
70
70
|
wo.group_currentGroup = ''; // save current groups
|
71
71
|
wo.group_currentGroups = {};
|
72
72
|
|
@@ -150,9 +150,6 @@ ts.grouping = {
|
|
150
150
|
}
|
151
151
|
});
|
152
152
|
c.$table.trigger(wo.group_complete);
|
153
|
-
if (c.debug) {
|
154
|
-
$.tablesorter.benchmark("Applying groups widget: ", time);
|
155
|
-
}
|
156
153
|
}
|
157
154
|
},
|
158
155
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* Pager widget for TableSorter
|
1
|
+
/* Pager widget for TableSorter 10/26/2014 (v2.18.0) - requires jQuery 1.7+ */
|
2
2
|
/*jshint browser:true, jquery:true, unused:false */
|
3
3
|
;(function($){
|
4
4
|
"use strict";
|
@@ -26,6 +26,9 @@ ts.addWidget({
|
|
26
26
|
// Number of visible rows
|
27
27
|
pager_size: 10,
|
28
28
|
|
29
|
+
// Number of options to include in the pager number selector
|
30
|
+
pager_maxOptionSize: 20,
|
31
|
+
|
29
32
|
// Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js)
|
30
33
|
pager_savePages: true,
|
31
34
|
|
@@ -153,12 +156,12 @@ tsp = ts.pager = {
|
|
153
156
|
p.$goto = p.$container.find(s.gotoPage); // goto is a reserved word #657
|
154
157
|
// page size selector
|
155
158
|
p.$size = p.$container.find(s.pageSize);
|
156
|
-
p.totalRows = c.$tbodies.eq(0).children('tr').not(
|
159
|
+
p.totalRows = c.$tbodies.eq(0).children('tr').not( wo.pager_countChildRows ? '' : '.' + c.cssChildRow ).length;
|
157
160
|
p.oldAjaxSuccess = p.oldAjaxSuccess || wo.pager_ajaxObject.success;
|
158
161
|
c.appender = tsp.appender;
|
159
162
|
if (ts.filter && $.inArray('filter', c.widgets) >= 0) {
|
160
163
|
// get any default filter settings (data-value attribute) fixes #388
|
161
|
-
p.currentFilters = c.$table.data('lastSearch') ||
|
164
|
+
p.currentFilters = c.$table.data('lastSearch') || [];
|
162
165
|
// set, but don't apply current filters
|
163
166
|
ts.setFilters(table, p.currentFilters, false);
|
164
167
|
}
|
@@ -179,6 +182,10 @@ tsp = ts.pager = {
|
|
179
182
|
|
180
183
|
tsp.enablePager(table, c, false);
|
181
184
|
|
185
|
+
// p must have ajaxObject
|
186
|
+
p.ajaxObject = wo.pager_ajaxObject; // $.extend({}, wo.pager_ajaxObject );
|
187
|
+
p.ajaxObject.url = wo.pager_ajaxUrl;
|
188
|
+
|
182
189
|
if ( typeof(wo.pager_ajaxUrl) === 'string' ) {
|
183
190
|
// ajax pager; interact with database
|
184
191
|
p.ajax = true;
|
@@ -197,7 +204,6 @@ tsp = ts.pager = {
|
|
197
204
|
|
198
205
|
initComplete: function(table, c){
|
199
206
|
var p = c.pager;
|
200
|
-
tsp.changeHeight(table, c);
|
201
207
|
tsp.bindEvents(table, c);
|
202
208
|
tsp.setPageSize(table, 0, c); // page size 0 is ignored
|
203
209
|
|
@@ -215,8 +221,8 @@ tsp = ts.pager = {
|
|
215
221
|
s = wo.pager_selectors;
|
216
222
|
|
217
223
|
c.$table
|
218
|
-
.
|
219
|
-
.
|
224
|
+
.off('filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet '.split(' ').join('.pager '))
|
225
|
+
.on('filterStart.pager', function(e, filters) {
|
220
226
|
p.currentFilters = filters;
|
221
227
|
// don't change page is filters are the same (pager updating, etc)
|
222
228
|
if (wo.pager_pageReset !== false && (c.lastCombinedFilter || '') !== (filters || []).join('')) {
|
@@ -224,21 +230,19 @@ tsp = ts.pager = {
|
|
224
230
|
}
|
225
231
|
})
|
226
232
|
// update pager after filter widget completes
|
227
|
-
.
|
233
|
+
.on('filterEnd.pager sortEnd.pager', function() {
|
228
234
|
if (p.initialized) {
|
229
235
|
if (c.delayInit && c.rowsCopy && c.rowsCopy.length === 0) {
|
230
236
|
// make sure we have a copy of all table rows once the cache has been built
|
231
237
|
tsp.updateCache(table);
|
232
238
|
}
|
233
|
-
// update page display first, so we update p.filteredPages
|
234
|
-
tsp.updatePageDisplay(table, c, false);
|
235
239
|
// tsp.moveToPage(table, p, false); <-- called when applyWidgets is triggered
|
236
240
|
c.pager.last.page = -1;
|
237
241
|
c.$table.trigger('applyWidgets');
|
238
|
-
tsp.
|
242
|
+
tsp.updatePageDisplay(table, c, false);
|
239
243
|
}
|
240
244
|
})
|
241
|
-
.
|
245
|
+
.on('disable.pager', function(e){
|
242
246
|
e.stopPropagation();
|
243
247
|
tsp.showAllRows(table, c);
|
244
248
|
})
|
@@ -254,16 +258,19 @@ tsp = ts.pager = {
|
|
254
258
|
e.stopPropagation();
|
255
259
|
// table can be unintentionally undefined in tablesorter v2.17.7 and earlier
|
256
260
|
if (!table || triggered) { return; }
|
257
|
-
tsp.fixHeight(table, c);
|
258
261
|
var $rows = c.$tbodies.eq(0).children('tr').not(c.selectorRemove);
|
259
|
-
p.totalRows = $rows.length - (
|
262
|
+
p.totalRows = $rows.length - ( wo.pager_countChildRows ? 0 : $rows.filter('.' + c.cssChildRow).length );
|
260
263
|
p.totalPages = Math.ceil( p.totalRows / p.size );
|
261
264
|
if ($rows.length && c.rowsCopy && c.rowsCopy.length === 0) {
|
262
265
|
// make a copy of all table rows once the cache has been built
|
263
266
|
tsp.updateCache(table);
|
264
267
|
}
|
265
|
-
|
268
|
+
if ( p.page >= p.totalPages ) {
|
269
|
+
tsp.moveToLastPage(table, p);
|
270
|
+
}
|
266
271
|
tsp.hideRows(table, c);
|
272
|
+
tsp.changeHeight(table, c);
|
273
|
+
tsp.updatePageDisplay(table, c);
|
267
274
|
// make sure widgets are applied - fixes #450
|
268
275
|
c.$table.trigger('applyWidgets');
|
269
276
|
})
|
@@ -287,8 +294,8 @@ tsp = ts.pager = {
|
|
287
294
|
fxn = [ 'moveToFirstPage', 'moveToPrevPage', 'moveToNextPage', 'moveToLastPage' ];
|
288
295
|
p.$container.find(ctrls.join(','))
|
289
296
|
.attr("tabindex", 0)
|
290
|
-
.
|
291
|
-
.
|
297
|
+
.off('click.pager')
|
298
|
+
.on('click.pager', function(e){
|
292
299
|
e.stopPropagation();
|
293
300
|
var i,
|
294
301
|
$c = $(this),
|
@@ -305,8 +312,8 @@ tsp = ts.pager = {
|
|
305
312
|
|
306
313
|
if ( p.$goto.length ) {
|
307
314
|
p.$goto
|
308
|
-
.
|
309
|
-
.
|
315
|
+
.off('change')
|
316
|
+
.on('change', function(){
|
310
317
|
p.page = $(this).val() - 1;
|
311
318
|
tsp.moveToPage(table, p, true);
|
312
319
|
tsp.updatePageDisplay(table, c, false);
|
@@ -317,8 +324,8 @@ tsp = ts.pager = {
|
|
317
324
|
// setting an option as selected appears to cause issues with initial page size
|
318
325
|
p.$size.find('option').removeAttr('selected');
|
319
326
|
p.$size
|
320
|
-
.
|
321
|
-
.
|
327
|
+
.off('change.pager')
|
328
|
+
.on('change.pager', function() {
|
322
329
|
p.$size.val( $(this).val() ); // in case there are more than one pagers
|
323
330
|
if ( !$(this).hasClass(wo.pager_css.disabled) ) {
|
324
331
|
tsp.setPageSize(table, parseInt( $(this).val(), 10 ), c);
|
@@ -345,32 +352,35 @@ tsp = ts.pager = {
|
|
345
352
|
}
|
346
353
|
},
|
347
354
|
|
348
|
-
|
349
|
-
var
|
350
|
-
wo = c.widgetOptions,
|
355
|
+
calcFilters: function(table, c) {
|
356
|
+
var wo = c.widgetOptions,
|
351
357
|
p = c.pager,
|
352
|
-
|
353
|
-
|
354
|
-
sz = p.size || 10; // don't allow dividing by zero
|
355
|
-
t = [ wo && wo.filter_filteredRow || 'filtered', c.selectorRemove.replace(/^(\w+\.)/g,'') ];
|
356
|
-
if (wo.pager_countChildRows) { t.push(c.cssChildRow); }
|
357
|
-
regex = new RegExp( '(' + t.join('|') + ')' );
|
358
|
-
p.$size.add(p.$goto).removeClass(wo.pager_css.disabled).removeAttr('disabled').attr('aria-disabled', 'false');
|
359
|
-
if (f && !wo.pager_ajaxUrl) {
|
358
|
+
hasFilters = c.$table.hasClass('hasFilters');
|
359
|
+
if (hasFilters && !wo.pager_ajaxUrl) {
|
360
360
|
if ($.isEmptyObject(c.cache)) {
|
361
361
|
// delayInit: true so nothing is in the cache
|
362
|
-
p.filteredRows = p.totalRows = c.$tbodies.eq(0).children('tr').not(
|
362
|
+
p.filteredRows = p.totalRows = c.$tbodies.eq(0).children('tr').not( wo.pager_countChildRows ? '' : '.' + c.cssChildRow ).length;
|
363
363
|
} else {
|
364
364
|
p.filteredRows = 0;
|
365
365
|
$.each(c.cache[0].normalized, function(i, el) {
|
366
366
|
p.filteredRows += p.regexRows.test(el[c.columns].$row[0].className) ? 0 : 1;
|
367
367
|
});
|
368
368
|
}
|
369
|
-
} else if (!
|
369
|
+
} else if (!hasFilters) {
|
370
370
|
p.filteredRows = p.totalRows;
|
371
371
|
}
|
372
|
+
},
|
373
|
+
|
374
|
+
updatePageDisplay: function(table, c, completed) {
|
375
|
+
var s, t, $out,
|
376
|
+
wo = c.widgetOptions,
|
377
|
+
p = c.pager,
|
378
|
+
sz = p.size || 10; // don't allow dividing by zero
|
379
|
+
if (wo.pager_countChildRows) { t.push(c.cssChildRow); }
|
380
|
+
p.$size.add(p.$goto).removeClass(wo.pager_css.disabled).removeAttr('disabled').attr('aria-disabled', 'false');
|
372
381
|
p.totalPages = Math.ceil( p.totalRows / sz ); // needed for "pageSize" method
|
373
382
|
c.totalRows = p.totalRows;
|
383
|
+
tsp.calcFilters(table, c);
|
374
384
|
c.filteredRows = p.filteredRows;
|
375
385
|
p.filteredPages = Math.ceil( p.filteredRows / sz ) || 0;
|
376
386
|
if ( Math.min( p.totalPages, p.filteredPages ) >= 0 ) {
|
@@ -400,19 +410,19 @@ tsp = ts.pager = {
|
|
400
410
|
}
|
401
411
|
return extra.length > 1 && data && data[extra[0]] ? data[extra[0]][extra[1]] : p[str] || (data ? data[str] : deflt) || deflt;
|
402
412
|
});
|
413
|
+
|
403
414
|
if ($out.length) {
|
404
415
|
$out[ ($out[0].tagName === 'INPUT') ? 'val' : 'html' ](s);
|
405
416
|
if ( p.$goto.length ) {
|
406
417
|
t = '';
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
p.$goto
|
412
|
-
p.$goto[0].value = p.page + 1;
|
418
|
+
$.each(tsp.buildPageSelect(p, c), function(i, opt){
|
419
|
+
t += '<option value="' + opt + '">' + opt + '</option>';
|
420
|
+
});
|
421
|
+
// innerHTML doesn't work in IE9 - http://support2.microsoft.com/kb/276228
|
422
|
+
p.$goto.html(t).val( p.page + 1 );
|
413
423
|
}
|
414
424
|
// rebind startRow/page inputs
|
415
|
-
$out.find('.ts-startRow, .ts-page').
|
425
|
+
$out.find('.ts-startRow, .ts-page').off('change').on('change', function(){
|
416
426
|
var v = $(this).val(),
|
417
427
|
pg = $(this).hasClass('ts-startRow') ? Math.floor( v/p.size ) + 1 : v;
|
418
428
|
c.$table.trigger('pageSet.pager', [ pg ]);
|
@@ -420,6 +430,7 @@ tsp = ts.pager = {
|
|
420
430
|
}
|
421
431
|
}
|
422
432
|
tsp.pagerArrows(c);
|
433
|
+
tsp.fixHeight(table, c);
|
423
434
|
if (p.initialized && completed !== false) {
|
424
435
|
c.$table.trigger('pagerComplete', c);
|
425
436
|
// save pager info to storage
|
@@ -432,27 +443,93 @@ tsp = ts.pager = {
|
|
432
443
|
}
|
433
444
|
},
|
434
445
|
|
446
|
+
buildPageSelect: function(p, c) {
|
447
|
+
// Filter the options page number link array if it's larger than 'pager_maxOptionSize'
|
448
|
+
// as large page set links will slow the browser on large dom inserts
|
449
|
+
var i, central_focus_size, focus_option_pages, insert_index, option_length, focus_length,
|
450
|
+
wo = c.widgetOptions,
|
451
|
+
pg = Math.min( p.totalPages, p.filteredPages ) || 1,
|
452
|
+
// make skip set size multiples of 5
|
453
|
+
skip_set_size = Math.ceil( ( pg / wo.pager_maxOptionSize ) / 5 ) * 5,
|
454
|
+
large_collection = pg > wo.pager_maxOptionSize,
|
455
|
+
current_page = p.page + 1,
|
456
|
+
start_page = skip_set_size,
|
457
|
+
end_page = pg - skip_set_size,
|
458
|
+
option_pages = [1],
|
459
|
+
// construct default options pages array
|
460
|
+
option_pages_start_page = (large_collection) ? skip_set_size : 1;
|
461
|
+
|
462
|
+
for ( i = option_pages_start_page; i <= pg; ) {
|
463
|
+
option_pages.push(i);
|
464
|
+
i = i + ( large_collection ? skip_set_size : 1 );
|
465
|
+
}
|
466
|
+
option_pages.push(pg);
|
467
|
+
|
468
|
+
if (large_collection) {
|
469
|
+
focus_option_pages = [];
|
470
|
+
// don't allow central focus size to be > 5 on either side of current page
|
471
|
+
central_focus_size = Math.max( Math.floor( wo.pager_maxOptionSize / skip_set_size ) - 1, 5 );
|
472
|
+
|
473
|
+
start_page = current_page - central_focus_size;
|
474
|
+
if (start_page < 1) { start_page = 1; }
|
475
|
+
end_page = current_page + central_focus_size;
|
476
|
+
if (end_page > pg) { end_page = pg; }
|
477
|
+
// construct an array to get a focus set around the current page
|
478
|
+
for (i = start_page; i <= end_page ; i++) {
|
479
|
+
focus_option_pages.push(i);
|
480
|
+
}
|
481
|
+
|
482
|
+
// keep unique values
|
483
|
+
option_pages = $.grep(option_pages, function(value, indx) {
|
484
|
+
return $.inArray(value, option_pages) === indx;
|
485
|
+
});
|
486
|
+
|
487
|
+
option_length = option_pages.length;
|
488
|
+
focus_length = focus_option_pages.length;
|
489
|
+
|
490
|
+
// make sure at all option_pages aren't replaced
|
491
|
+
if (option_length - focus_length > skip_set_size / 2 && option_length + focus_length > wo.pager_maxOptionSize ) {
|
492
|
+
insert_index = Math.floor(option_length / 2) - Math.floor(focus_length / 2);
|
493
|
+
Array.prototype.splice.apply(option_pages, [ insert_index, focus_length ]);
|
494
|
+
}
|
495
|
+
option_pages = option_pages.concat(focus_option_pages);
|
496
|
+
|
497
|
+
}
|
498
|
+
|
499
|
+
// keep unique values again
|
500
|
+
option_pages = $.grep(option_pages, function(value, indx) {
|
501
|
+
return $.inArray(value, option_pages) === indx;
|
502
|
+
})
|
503
|
+
.sort(function(a,b) { return a - b; });
|
504
|
+
|
505
|
+
return option_pages;
|
506
|
+
},
|
507
|
+
|
435
508
|
fixHeight: function(table, c) {
|
436
509
|
var d, h,
|
437
510
|
p = c.pager,
|
438
511
|
wo = c.widgetOptions,
|
439
512
|
$b = c.$tbodies.eq(0);
|
440
|
-
|
441
|
-
|
513
|
+
$b.find('tr.pagerSavedHeightSpacer').remove();
|
514
|
+
if (wo.pager_fixedHeight && !p.isDisabled) {
|
442
515
|
h = $.data(table, 'pagerSavedHeight');
|
443
516
|
if (h) {
|
444
517
|
d = h - $b.height();
|
445
518
|
if ( d > 5 && $.data(table, 'pagerLastSize') === p.size && $b.children('tr:visible').length < p.size ) {
|
446
|
-
$b.append('<tr class="pagerSavedHeightSpacer ' +
|
519
|
+
$b.append('<tr class="pagerSavedHeightSpacer ' + c.selectorRemove.slice(1) + '" style="height:' + d + 'px;"></tr>');
|
447
520
|
}
|
448
521
|
}
|
449
522
|
}
|
450
523
|
},
|
451
524
|
|
452
525
|
changeHeight: function(table, c) {
|
453
|
-
var $b = c.$tbodies.eq(0);
|
526
|
+
var h, $b = c.$tbodies.eq(0);
|
454
527
|
$b.find('tr.pagerSavedHeightSpacer').remove();
|
455
|
-
|
528
|
+
if (!$b.children('tr:visible').length) {
|
529
|
+
$b.append('<tr class="pagerSavedHeightSpacer ' + c.selectorRemove.slice(1) + '"><td> </td></tr>');
|
530
|
+
}
|
531
|
+
h = $b.children('tr').eq(0).height() * c.pager.size;
|
532
|
+
$.data(table, 'pagerSavedHeight', h);
|
456
533
|
tsp.fixHeight(table, c);
|
457
534
|
$.data(table, 'pagerLastSize', c.pager.size);
|
458
535
|
},
|
@@ -606,7 +683,6 @@ tsp = ts.pager = {
|
|
606
683
|
p.last.currentFilters = p.currentFilters;
|
607
684
|
p.last.sortList = (c.sortList || []).join(',');
|
608
685
|
tsp.updatePageDisplay(table, c);
|
609
|
-
tsp.fixHeight(table, c);
|
610
686
|
$t.trigger('updateCache', [function(){
|
611
687
|
if (p.initialized) {
|
612
688
|
// apply widgets after table has rendered & after a delay to prevent
|
@@ -628,7 +704,6 @@ tsp = ts.pager = {
|
|
628
704
|
var counter,
|
629
705
|
url = tsp.getAjaxUrl(table, c),
|
630
706
|
$doc = $(document),
|
631
|
-
wo = c.widgetOptions,
|
632
707
|
p = c.pager;
|
633
708
|
if ( url !== '' ) {
|
634
709
|
if (c.showProcessing) {
|
@@ -636,25 +711,25 @@ tsp = ts.pager = {
|
|
636
711
|
}
|
637
712
|
$doc.on('ajaxError.pager', function(e, xhr, settings, exception) {
|
638
713
|
tsp.renderAjax(null, table, c, xhr, exception);
|
639
|
-
$doc.
|
714
|
+
$doc.off('ajaxError.pager');
|
640
715
|
});
|
641
716
|
counter = ++p.ajaxCounter;
|
642
|
-
|
643
|
-
|
717
|
+
p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
|
718
|
+
p.ajaxObject.success = function(data, status, jqxhr) {
|
644
719
|
// Refuse to process old ajax commands that were overwritten by new ones - see #443
|
645
720
|
if (counter < p.ajaxCounter){
|
646
721
|
return;
|
647
722
|
}
|
648
723
|
tsp.renderAjax(data, table, c, jqxhr);
|
649
|
-
$doc.
|
724
|
+
$doc.off('ajaxError.pager');
|
650
725
|
if (typeof p.oldAjaxSuccess === 'function') {
|
651
726
|
p.oldAjaxSuccess(data);
|
652
727
|
}
|
653
728
|
};
|
654
729
|
if (c.debug) {
|
655
|
-
ts.log('ajax initialized',
|
730
|
+
ts.log('ajax initialized', p.ajaxObject);
|
656
731
|
}
|
657
|
-
$.ajax(
|
732
|
+
$.ajax(p.ajaxObject);
|
658
733
|
}
|
659
734
|
},
|
660
735
|
|
@@ -745,7 +820,6 @@ tsp = ts.pager = {
|
|
745
820
|
}
|
746
821
|
|
747
822
|
tsp.updatePageDisplay(table, c);
|
748
|
-
if ( !p.isDisabled ) { tsp.fixHeight(table, c); }
|
749
823
|
|
750
824
|
wo.pager_startPage = p.page;
|
751
825
|
wo.pager_size = p.size;
|
@@ -810,9 +884,11 @@ tsp = ts.pager = {
|
|
810
884
|
if ( pageMoved !== false && p.initialized && $.isEmptyObject(table.config.cache)) {
|
811
885
|
return tsp.updateCache(table);
|
812
886
|
}
|
813
|
-
var c = table.config,
|
814
|
-
|
815
|
-
|
887
|
+
var pg, c = table.config,
|
888
|
+
wo = c.widgetOptions,
|
889
|
+
l = p.last;
|
890
|
+
tsp.calcFilters(table, c);
|
891
|
+
pg = Math.min( p.totalPages, p.filteredPages );
|
816
892
|
if ( p.page < 0 ) { p.page = 0; }
|
817
893
|
if ( p.page > ( pg - 1 ) && pg !== 0 ) { p.page = pg - 1; }
|
818
894
|
// fixes issue where one current filter is [] and the other is ['','',''],
|
@@ -822,6 +898,10 @@ tsp = ts.pager = {
|
|
822
898
|
// don't allow rendering multiple times on the same page/size/totalRows/filters/sorts
|
823
899
|
if ( l.page === p.page && l.size === p.size && l.totalRows === p.totalRows &&
|
824
900
|
(l.currentFilters || []).join(',') === (p.currentFilters || []).join(',') &&
|
901
|
+
// check for ajax url changes see #730
|
902
|
+
(l.ajaxUrl || '') === (p.ajaxObject.url || '') &&
|
903
|
+
// & ajax url option changes (dynamically add/remove/rename sort & filter parameters)
|
904
|
+
(l.optAjaxUrl || '') === (wo.pager_ajaxUrl || '') &&
|
825
905
|
l.sortList === (c.sortList || []).join(',') ) {
|
826
906
|
return;
|
827
907
|
}
|
@@ -834,7 +914,9 @@ tsp = ts.pager = {
|
|
834
914
|
// fixes #408; modify sortList otherwise it auto-updates
|
835
915
|
sortList : (c.sortList || []).join(','),
|
836
916
|
totalRows : p.totalRows,
|
837
|
-
currentFilters : p.currentFilters || []
|
917
|
+
currentFilters : p.currentFilters || [],
|
918
|
+
ajaxUrl : p.ajaxObject.url || '',
|
919
|
+
optAjaxUrl : wo.pager_ajaxUrl
|
838
920
|
};
|
839
921
|
if (p.ajax) {
|
840
922
|
tsp.getAjax(table, c);
|
@@ -896,7 +978,7 @@ tsp = ts.pager = {
|
|
896
978
|
c.appender = null; // remove pager appender function
|
897
979
|
p.initialized = false;
|
898
980
|
delete table.config.rowsCopy;
|
899
|
-
c.$table.
|
981
|
+
c.$table.off('destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager');
|
900
982
|
if (ts.storage) {
|
901
983
|
ts.storage(table, c.widgetOptions.pager_storageKey, '');
|
902
984
|
}
|
@@ -916,11 +998,11 @@ tsp = ts.pager = {
|
|
916
998
|
p.$container.find(c.widgetOptions.pager_selectors.pageDisplay).attr('id', info);
|
917
999
|
c.$table.attr('aria-describedby', info);
|
918
1000
|
}
|
1001
|
+
tsp.changeHeight(table, c);
|
919
1002
|
if ( triggered ) {
|
920
1003
|
c.$table.trigger('updateRows');
|
921
1004
|
tsp.setPageSize(table, p.size, c);
|
922
1005
|
tsp.hideRowsSetup(table, c);
|
923
|
-
tsp.fixHeight(table, c);
|
924
1006
|
if (c.debug) {
|
925
1007
|
ts.log('pager enabled');
|
926
1008
|
}
|
@@ -933,7 +1015,7 @@ tsp = ts.pager = {
|
|
933
1015
|
p = c.pager;
|
934
1016
|
if ( !p.ajax ) {
|
935
1017
|
c.rowsCopy = rows;
|
936
|
-
p.totalRows =
|
1018
|
+
p.totalRows = wo.pager_countChildRows ? c.$tbodies.eq(0).children('tr').length : rows.length;
|
937
1019
|
p.size = $.data(table, 'pagerLastSize') || p.size || wo.pager_size || 10;
|
938
1020
|
p.totalPages = Math.ceil( p.totalRows / p.size );
|
939
1021
|
tsp.moveToPage(table, p);
|
@@ -951,7 +1033,8 @@ ts.showError = function(table, message){
|
|
951
1033
|
$(table).each(function(){
|
952
1034
|
var $row,
|
953
1035
|
c = this.config,
|
954
|
-
|
1036
|
+
wo = c.widgetOptions,
|
1037
|
+
errorRow = c.pager && c.pager.cssErrorRow || wo.pager_css && wo.pager_css.errorRow || 'tablesorter-errorRow';
|
955
1038
|
if (c) {
|
956
1039
|
if (typeof message === 'undefined') {
|
957
1040
|
c.$table.find('thead').find(c.selectorRemove).remove();
|