jquery-tablesorter 1.10.1 → 1.10.10

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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/{README.markdown → README.md} +8 -3
  3. data/Rakefile +39 -35
  4. data/lib/jquery-tablesorter/version.rb +1 -1
  5. data/lib/jquery-tablesorter.rb +1 -1
  6. data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +66 -29
  7. data/vendor/assets/javascripts/jquery-tablesorter/extras/jquery.quicksearch.js +191 -0
  8. data/vendor/assets/javascripts/jquery-tablesorter/extras/semver-mod.js +1026 -0
  9. data/vendor/assets/javascripts/jquery-tablesorter/extras/semver.js +1011 -0
  10. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +156 -99
  11. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets-filter-formatter.js +22 -22
  12. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +68 -42
  13. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-iso8601.js +34 -0
  14. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js +33 -0
  15. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-two-digit-year.js +74 -0
  16. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-weekday.js +33 -0
  17. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date.js +36 -0
  18. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-feet-inch-fraction.js +63 -0
  19. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-file-type.js +73 -0
  20. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-ignore-articles.js +47 -0
  21. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-input-select.js +87 -0
  22. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-ipv6.js +76 -0
  23. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-metric.js +77 -0
  24. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-alignChar.js +145 -0
  25. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-build-table.js +441 -0
  26. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columnSelector.js +306 -0
  27. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-cssStickyHeaders.js +67 -0
  28. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-editable.js +89 -0
  29. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-grouping.js +249 -0
  30. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-headerTitles.js +91 -0
  31. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +864 -0
  32. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-repeatheaders.js +50 -0
  33. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-scroller.js +241 -0
  34. data/vendor/assets/stylesheets/jquery-tablesorter/theme.black-ice.css +4 -0
  35. data/vendor/assets/stylesheets/jquery-tablesorter/theme.blue.css +4 -0
  36. data/vendor/assets/stylesheets/jquery-tablesorter/theme.bootstrap.css +14 -5
  37. data/vendor/assets/stylesheets/jquery-tablesorter/theme.bootstrap_2.css +4 -0
  38. data/vendor/assets/stylesheets/jquery-tablesorter/theme.dark.css +4 -0
  39. data/vendor/assets/stylesheets/jquery-tablesorter/theme.default.css +4 -0
  40. data/vendor/assets/stylesheets/jquery-tablesorter/theme.dropbox.css +4 -0
  41. data/vendor/assets/stylesheets/jquery-tablesorter/theme.green.css +4 -0
  42. data/vendor/assets/stylesheets/jquery-tablesorter/theme.grey.css +4 -0
  43. data/vendor/assets/stylesheets/jquery-tablesorter/theme.ice.css +4 -0
  44. data/vendor/assets/stylesheets/jquery-tablesorter/theme.jui.css +9 -3
  45. metadata +28 -12
  46. data/vendor/assets/images/jquery-tablesorter/dropbox-asc1.png +0 -0
  47. data/vendor/assets/images/jquery-tablesorter/dropbox-asc2.png +0 -0
  48. data/vendor/assets/images/jquery-tablesorter/dropbox-desc1.png +0 -0
  49. data/vendor/assets/images/jquery-tablesorter/dropbox-desc2.png +0 -0
  50. data/vendor/assets/images/jquery-tablesorter/green-asc.png +0 -0
  51. data/vendor/assets/images/jquery-tablesorter/green-desc.png +0 -0
  52. data/vendor/assets/images/jquery-tablesorter/green-header.png +0 -0
  53. data/vendor/assets/images/jquery-tablesorter/green-unsorted.png +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f993d3ad9edc10a4ede7f829031260e60b3de88c
4
- data.tar.gz: f6a09c02fc388e5322308d39e076c16d40a1cd7d
3
+ metadata.gz: 1591f84710f85ceb7162d750a39df47356371b14
4
+ data.tar.gz: 1be6e92aa78bf994599a91a5c8ce4107442800fd
5
5
  SHA512:
6
- metadata.gz: 2a22160b93179c27adaa2d57d649512fa9eee01224ed89c119ee366c059b4fa42550b45a1985f01fc23511f0a778d6d68f6379044d11d7ba8319411777ce54f3
7
- data.tar.gz: c7e04027e5100364c0d6bb412c92a8d9f954244b635cb854db493b563fc8b7ba06b05e89fed39c41d781cb90da75ac97597615a06353664604205e8831d1c2be
6
+ metadata.gz: 6f844b8b9ea9af7ccdc7389b55e69ed24f727a7c565355de3a9212552400a1327498fd82466ca3deb5c537a3beee49d931833c8a31724a3bb2b23078901d9181
7
+ data.tar.gz: 8eb94e20072ac16362d837190fd8407c50d17b290db3b46ea037549aab87e338ba1836068ac24279622250e372d030f5c2a075d33b973d496ebb8e17dc7d9fd8
@@ -4,7 +4,7 @@
4
4
 
5
5
  Simple integration of jquery-tablesorter into the asset pipeline.
6
6
 
7
- Current tablesorter version: 2.15.1 (2/19/2014), [documentation]
7
+ Current tablesorter version: 2.15.14 (4/10/2014), [documentation]
8
8
 
9
9
  Any issue associate with the js/css files, please report to [Mottie's fork].
10
10
 
@@ -24,7 +24,9 @@ Or install it yourself as:
24
24
 
25
25
  ## Requirements
26
26
 
27
- Rails 3.1 and higher
27
+ Rails 3.1 and higher (tested up to 4.1)
28
+
29
+ Tested with ruby 1.9.3 - 2.1.1
28
30
 
29
31
  ## Usage
30
32
 
@@ -36,7 +38,7 @@ In your `application.js`
36
38
  //= require jquery-tablesorter
37
39
  ```
38
40
 
39
- This will require all jquery-tablesorter files (exclude addons).
41
+ This will require all jquery-tablesorter files (excluding addons and extras).
40
42
 
41
43
  Or you can include single file with:
42
44
 
@@ -45,6 +47,9 @@ Or you can include single file with:
45
47
  //= require jquery-tablesorter/jquery.tablesorter
46
48
  //= require jquery-tablesorter/jquery.tablesorter.widgets
47
49
  //= require jquery-tablesorter/addons/pager/jquery.tablesorter.pager
50
+ //= require jquery-tablesorter/widgets/widget-repeatheaders
51
+ //= require jquery-tablesorter/parsers/parser-metric
52
+ //= require jquery-tablesorter/extras/jquery.quicksearch
48
53
  ```
49
54
 
50
55
  ### Stylesheet files
data/Rakefile CHANGED
@@ -4,58 +4,62 @@ require 'bundler'
4
4
  Bundler::GemHelper.install_tasks
5
5
 
6
6
  namespace :jquery_tablesorter do
7
- desc 'update tablesorter'
7
+
8
+ desc 'Update tablesorter files'
8
9
  task :update do
10
+
9
11
  # javascripts
10
12
  #
11
- javascript_dir = 'vendor/assets/javascripts/jquery-tablesorter'
12
- FileUtils.mkdir_p(javascript_dir)
13
- Dir.glob('tablesorter/js/*.js').reject{ |file| file =~ /.min.js\Z/}.each do |file|
14
- FileUtils.cp file, javascript_dir, :verbose => true
15
- end
13
+ javascript_dir = File.join('vendor', 'assets', 'javascripts', 'jquery-tablesorter')
14
+ copy_files(Dir.glob(File.join('tablesorter', 'js', '*.js')).reject{|file| file =~ /.min.js\Z/}, javascript_dir)
16
15
 
17
16
  # stylesheets
18
17
  #
19
- stylesheet_dir = 'vendor/assets/stylesheets/jquery-tablesorter'
20
- FileUtils.mkdir_p(stylesheet_dir)
21
- Dir.glob('tablesorter/css/*.css').each do |file|
22
- FileUtils.cp file, stylesheet_dir, :verbose => true
23
- end
18
+ stylesheet_dir = File.join('vendor', 'assets', 'stylesheets', 'jquery-tablesorter')
19
+ copy_files(Dir.glob(File.join('tablesorter', 'css', '*.css')), stylesheet_dir)
24
20
 
25
21
  # images
26
22
  #
27
- images_dir = 'vendor/assets/images/jquery-tablesorter'
28
- FileUtils.mkdir_p(images_dir)
29
- Dir.glob('tablesorter/css/images/*').each do |file|
30
- FileUtils.cp file, images_dir, :verbose => true
31
- end
23
+ images_dir = File.join('vendor', 'assets', 'images', 'jquery-tablesorter')
24
+ copy_files(Dir.glob(File.join('tablesorter', 'css', 'images', '*')), images_dir)
32
25
 
33
26
  # addons
34
27
  #
35
28
  ## pager
36
- pager_stylesheet_dir = stylesheet_dir + '/addons/pager'
37
- FileUtils.mkdir_p(pager_stylesheet_dir)
38
- FileUtils.cp 'tablesorter/addons/pager/jquery.tablesorter.pager.css',
39
- pager_stylesheet_dir,
40
- :verbose => true
41
-
42
- pager_javascript_dir = javascript_dir + '/addons/pager'
43
- FileUtils.mkdir_p(pager_javascript_dir)
44
- FileUtils.cp 'tablesorter/addons/pager/jquery.tablesorter.pager.js',
45
- pager_javascript_dir,
46
- :verbose => true
47
-
48
- pager_images_dir = images_dir + '/addons/pager'
49
- FileUtils.mkdir_p(pager_images_dir)
50
- FileUtils.cp_r 'tablesorter/addons/pager/icons', pager_images_dir,
51
- :verbose => true
29
+ pager_stylesheet_dir = File.join(stylesheet_dir, 'addons', 'pager')
30
+ copy_files([File.join('tablesorter', 'addons', 'pager', 'jquery.tablesorter.pager.css')], pager_stylesheet_dir)
31
+
32
+ pager_javascript_dir = File.join(javascript_dir, 'addons', 'pager')
33
+ copy_files([File.join('tablesorter', 'addons', 'pager', 'jquery.tablesorter.pager.js')], pager_javascript_dir)
34
+
35
+ pager_images_dir = File.join(images_dir, 'addons', 'pager', 'icons')
36
+ copy_files(Dir.glob(File.join('tablesorter', 'addons', 'pager', 'icons', '*')), pager_images_dir)
37
+
38
+
39
+ # parsers, widgets and extras
40
+ #
41
+ %w(parsers widgets extras).each do |folder|
42
+ folder_javascript_dir = File.join(javascript_dir, folder)
43
+ files = Dir.glob(File.join('tablesorter', 'js', folder, '*.js')).reject{|file| file =~ /.min.js\Z/}
44
+ copy_files(files, folder_javascript_dir)
45
+ end
46
+
47
+ end
48
+
49
+ def copy_files(files, target_dir)
50
+ FileUtils.mkdir_p(target_dir)
51
+ FileUtils.rm_rf("#{target_dir}/.", :secure => true)
52
+
53
+ files.each do |file|
54
+ FileUtils.cp(file, target_dir, :verbose => true)
55
+ end
52
56
  end
53
57
 
54
58
  desc 'Sanitize image paths'
55
59
  task :sanitize_image_paths do
56
- Dir.glob('vendor/assets/stylesheets/jquery-tablesorter/*.css').each do |file_path|
57
- content = File.read(file_path).gsub(/url\(images\//, "url(/assets/jquery-tablesorter/")
58
- File.open(file_path, "w") {|file| file.write content}
60
+ Dir.glob(File.join('vendor', 'assets', 'stylesheets', 'jquery-tablesorter', '*.css')).each do |file_path|
61
+ content = File.read(file_path).gsub(/url\(images\//, 'url(/assets/jquery-tablesorter/')
62
+ File.open(file_path, 'w') {|file| file.write content}
59
63
  end
60
64
  end
61
65
  end
@@ -1,3 +1,3 @@
1
1
  module JqueryTablesorter
2
- VERSION = "1.10.1"
2
+ VERSION = '1.10.10'
3
3
  end
@@ -1,4 +1,4 @@
1
- require "jquery-tablesorter/engine"
1
+ require 'jquery-tablesorter/engine'
2
2
 
3
3
  module JqueryTablesorter
4
4
  end
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * tablesorter pager plugin
3
- * updated 2/19/2014 (v2.15.0)
3
+ * updated 4/10/2014 (v2.15.14)
4
4
  */
5
5
  /*jshint browser:true, jquery:true, unused:false */
6
6
  ;(function($) {
@@ -124,7 +124,7 @@
124
124
  }
125
125
  },
126
126
 
127
- updatePageDisplay = function(table, p, flag) {
127
+ updatePageDisplay = function(table, p, completed) {
128
128
  var i, pg, s, out,
129
129
  c = table.config,
130
130
  f = c.$table.hasClass('hasFilters') && !p.ajaxUrl,
@@ -168,7 +168,7 @@
168
168
  }
169
169
  }
170
170
  pagerArrows(p);
171
- if (p.initialized && flag !== false) {
171
+ if (p.initialized && completed !== false) {
172
172
  c.$table.trigger('pagerComplete', p);
173
173
  // save pager info to storage
174
174
  if (p.savePages && ts.storage) {
@@ -207,6 +207,7 @@
207
207
  hideRows = function(table, p){
208
208
  if (!p.ajaxUrl) {
209
209
  var i,
210
+ lastIndex = 0,
210
211
  c = table.config,
211
212
  rows = c.$tbodies.eq(0).children(),
212
213
  l = rows.length,
@@ -216,9 +217,23 @@
216
217
  j = 0; // size counter
217
218
  for ( i = 0; i < l; i++ ){
218
219
  if ( !rows[i].className.match(f) ) {
219
- rows[i].style.display = ( j >= s && j < e ) ? '' : 'none';
220
- // don't count child rows
221
- j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.slice(1)) && !p.countChildRows ? 0 : 1;
220
+ if (j === s && rows[i].className.match(c.cssChildRow)) {
221
+ // hide child rows @ start of pager (if already visible)
222
+ rows[i].style.display = 'none';
223
+ } else {
224
+ rows[i].style.display = ( j >= s && j < e ) ? '' : 'none';
225
+ // don't count child rows
226
+ j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.slice(1)) && !p.countChildRows ? 0 : 1;
227
+ if ( j === e && rows[i].style.display !== 'none' && rows[i].className.match(ts.css.cssHasChild) ) {
228
+ lastIndex = i;
229
+ }
230
+ }
231
+ }
232
+ }
233
+ // add any attached child rows to last row of pager. Fixes part of issue #396
234
+ if ( lastIndex > 0 && rows[lastIndex].className.match(ts.css.cssHasChild) ) {
235
+ while ( ++lastIndex < l && rows[lastIndex].className.match(c.cssChildRow) ) {
236
+ rows[lastIndex].style.display = '';
222
237
  }
223
238
  }
224
239
  }
@@ -263,6 +278,7 @@
263
278
  exception === 'abort' ? 'Ajax Request aborted' :
264
279
  'Uncaught error: ' + xhr.statusText + ' [' + xhr.status + ']' );
265
280
  c.$tbodies.eq(0).empty();
281
+ p.totalRows = 0;
266
282
  } else {
267
283
  // process ajax object
268
284
  if (!$.isArray(result)) {
@@ -273,7 +289,7 @@
273
289
  } else {
274
290
  // allow [ total, rows, headers ] or [ rows, total, headers ]
275
291
  t = isNaN(result[0]) && !isNaN(result[1]);
276
- //ensure a zero returned row count doesn't fail the logical ||
292
+ // ensure a zero returned row count doesn't fail the logical ||
277
293
  rr_count = result[t ? 1 : 0];
278
294
  p.totalRows = isNaN(rr_count) ? p.totalRows || 0 : rr_count;
279
295
  d = p.totalRows === 0 ? [""] : result[t ? 0 : 1] || []; // row data
@@ -281,8 +297,10 @@
281
297
  }
282
298
  l = d.length;
283
299
  if (d instanceof jQuery) {
284
- // append jQuery object
285
- c.$tbodies.eq(0).empty().append(d);
300
+ if (p.processAjaxOnInit) {
301
+ // append jQuery object
302
+ c.$tbodies.eq(0).empty().append(d);
303
+ }
286
304
  } else if (l) {
287
305
  // build table from array
288
306
  for ( i = 0; i < l; i++ ) {
@@ -296,10 +314,9 @@
296
314
  // add rows to first tbody
297
315
  if (p.processAjaxOnInit) {
298
316
  c.$tbodies.eq(0).html( tds );
299
- } else {
300
- p.processAjaxOnInit = true;
301
317
  }
302
318
  }
319
+ p.processAjaxOnInit = true;
303
320
  // only add new header text if the length matches
304
321
  if ( th && th.length === hl ) {
305
322
  hsh = $t.hasClass('hasStickyHeaders');
@@ -331,23 +348,27 @@
331
348
  }
332
349
  // make sure last pager settings are saved, prevents multiple server side calls with
333
350
  // the same parameters
334
- p.last.totalPages = p.totalPages = Math.ceil( p.totalRows / ( p.size || 10 ) );
351
+ p.totalPages = Math.ceil( p.totalRows / ( p.size || 10 ) );
352
+ p.last.totalRows = p.totalRows;
335
353
  p.last.currentFilters = p.currentFilters;
336
354
  p.last.sortList = (c.sortList || []).join(',');
337
355
  updatePageDisplay(table, p);
338
356
  fixHeight(table, p);
339
- // apply widgets after table has rendered
340
- $t.trigger('applyWidgets');
341
- $t.trigger('updateRows', [false, function(){
357
+ $t.trigger('updateCache', [function(){
342
358
  if (p.initialized) {
343
- $t.trigger('updateComplete');
344
- $t.trigger('pagerChange', p);
359
+ // apply widgets after table has rendered
360
+ $t
361
+ .trigger('applyWidgets')
362
+ .trigger('pagerChange', p);
345
363
  }
346
364
  }]);
365
+
347
366
  }
348
367
  if (!p.initialized) {
349
368
  p.initialized = true;
350
- $(table).trigger('pagerInitialized', p);
369
+ $(table)
370
+ .trigger('applyWidgets')
371
+ .trigger('pagerInitialized', p);
351
372
  }
352
373
  },
353
374
 
@@ -428,6 +449,8 @@
428
449
 
429
450
  renderTable = function(table, rows, p) {
430
451
  var i, $tb,
452
+ $t = $(table),
453
+ c = table.config,
431
454
  l = rows && rows.length || 0, // rows may be undefined
432
455
  s = ( p.page * p.size ),
433
456
  e = ( s + p.size );
@@ -437,7 +460,7 @@
437
460
  moveToLastPage(table, p);
438
461
  }
439
462
  p.isDisabled = false; // needed because sorting will change the page and re-enable the pager
440
- if (p.initialized) { $(table).trigger('pagerChange', p); }
463
+ if (p.initialized) { $t.trigger('pagerChange', p); }
441
464
 
442
465
  if ( !p.removeRows ) {
443
466
  hideRows(table, p);
@@ -446,16 +469,20 @@
446
469
  e = rows.length;
447
470
  }
448
471
  ts.clearTableBody(table);
449
- $tb = ts.processTbody(table, table.config.$tbodies.eq(0), true);
472
+ $tb = ts.processTbody(table, c.$tbodies.eq(0), true);
450
473
  for ( i = s; i < e; i++ ) {
451
474
  $tb.append(rows[i]);
452
475
  }
476
+
453
477
  ts.processTbody(table, $tb, false);
454
478
  }
455
479
 
456
480
  updatePageDisplay(table, p);
457
481
  if ( !p.isDisabled ) { fixHeight(table, p); }
458
- $(table).trigger('applyWidgets');
482
+ $t.trigger('applyWidgets');
483
+ if (table.isUpdating) {
484
+ $t.trigger("updateComplete", table);
485
+ }
459
486
  },
460
487
 
461
488
  showAllRows = function(table, p){
@@ -483,15 +510,20 @@
483
510
  });
484
511
  },
485
512
 
486
- moveToPage = function(table, p, flag) {
513
+ moveToPage = function(table, p, pageMoved) {
487
514
  if ( p.isDisabled ) { return; }
488
515
  var c = table.config,
516
+ $t = $(table),
489
517
  l = p.last,
490
518
  pg = Math.min( p.totalPages, p.filteredPages );
491
519
  if ( p.page < 0 ) { p.page = 0; }
492
520
  if ( p.page > ( pg - 1 ) && pg !== 0 ) { p.page = pg - 1; }
493
- // don't allow rendering multiple times on the same page/size/totalpages/filters/sorts
494
- if ( l.page === p.page && l.size === p.size && l.totalPages === p.totalPages &&
521
+ // fixes issue where one currentFilter is [] and the other is ['','',''],
522
+ // making the next if comparison think the filters are different (joined by commas). Fixes #202.
523
+ l.currentFilters = (l.currentFilters || []).join('') === '' ? [] : l.currentFilters;
524
+ p.currentFilters = (p.currentFilters || []).join('') === '' ? [] : p.currentFilters;
525
+ // don't allow rendering multiple times on the same page/size/totalRows/filters/sorts
526
+ if ( l.page === p.page && l.size === p.size && l.totalRows === p.totalRows &&
495
527
  (l.currentFilters || []).join(',') === (p.currentFilters || []).join(',') &&
496
528
  l.sortList === (c.sortList || []).join(',') ) { return; }
497
529
  if (c.debug) {
@@ -502,18 +534,22 @@
502
534
  size : p.size,
503
535
  // fixes #408; modify sortList otherwise it auto-updates
504
536
  sortList : (c.sortList || []).join(','),
505
- totalPages : p.totalPages,
537
+ totalRows : p.totalRows,
506
538
  currentFilters : p.currentFilters || []
507
539
  };
508
540
  if (p.ajax) {
509
541
  getAjax(table, p);
510
542
  } else if (!p.ajax) {
511
- renderTable(table, table.config.rowsCopy, p);
543
+ renderTable(table, c.rowsCopy, p);
512
544
  }
513
545
  $.data(table, 'pagerLastPage', p.page);
514
- if (p.initialized && flag !== false) {
515
- c.$table.trigger('pageMoved', p);
516
- c.$table.trigger('applyWidgets');
546
+ if (p.initialized && pageMoved !== false) {
547
+ $t
548
+ .trigger('pageMoved', p)
549
+ .trigger('applyWidgets');
550
+ if (table.isUpdating) {
551
+ $t.trigger('updateComplete');
552
+ }
517
553
  }
518
554
  },
519
555
 
@@ -523,6 +559,7 @@
523
559
  $.data(table, 'pagerLastPage', p.page);
524
560
  $.data(table, 'pagerLastSize', p.size);
525
561
  p.totalPages = Math.ceil( p.totalRows / p.size );
562
+ p.filteredPages = Math.ceil( p.filteredRows / p.size );
526
563
  moveToPage(table, p);
527
564
  },
528
565
 
@@ -0,0 +1,191 @@
1
+ /* jQuery Quicksearch plugin
2
+ by riklomas https://github.com/riklomas/quicksearch
3
+ Modified to include childRows (for tablesorter)
4
+
5
+ See http://stackoverflow.com/q/20342203/145346 for
6
+ more details
7
+ */
8
+ (function($, window, document, undefined) {
9
+ $.fn.quicksearch = function (target, opt) {
10
+
11
+ var timeout, cache, rowcache, jq_results, val = '', e = this, options = $.extend({
12
+ delay: 100,
13
+ selector: null,
14
+ stripeRows: null,
15
+ loader: null,
16
+ noResults: '',
17
+ childRow: 'tablesorter-childRow', // include child row with search results
18
+ matchedResultsCount: 0,
19
+ bind: 'keyup',
20
+ onBefore: function () {
21
+ return;
22
+ },
23
+ onAfter: function () {
24
+ return;
25
+ },
26
+ show: function () {
27
+ this.style.display = "";
28
+ },
29
+ hide: function () {
30
+ this.style.display = "none";
31
+ },
32
+ prepareQuery: function (val) {
33
+ return val.toLowerCase().split(' ');
34
+ },
35
+ testQuery: function (query, txt, _row) {
36
+ for (var i = 0; i < query.length; i += 1) {
37
+ if (txt.indexOf(query[i]) === -1) {
38
+ return false;
39
+ }
40
+ }
41
+ return true;
42
+ }
43
+ }, opt);
44
+
45
+ this.go = function () {
46
+
47
+ var i = 0,
48
+ numMatchedRows = 0,
49
+ noresults = true,
50
+ query = options.prepareQuery(val),
51
+ val_empty = (val.replace(' ', '').length === 0);
52
+
53
+ for (var i = 0, len = rowcache.length; i < len; i++) {
54
+ if (val_empty || options.testQuery(query, cache[i], rowcache[i]) ||
55
+ ($(rowcache[i]).hasClass(options.childRow) && $(rowcache[i > 1 ? i - 1 : 0]).is(':visible'))) {
56
+ options.show.apply(rowcache[i]);
57
+ noresults = false;
58
+ numMatchedRows++;
59
+ } else {
60
+ options.hide.apply(rowcache[i]);
61
+ }
62
+ }
63
+
64
+ if (noresults) {
65
+ this.results(false);
66
+ } else {
67
+ this.results(true);
68
+ this.stripe();
69
+ }
70
+
71
+ this.matchedResultsCount = numMatchedRows;
72
+ this.loader(false);
73
+ options.onAfter();
74
+
75
+ return this;
76
+ };
77
+
78
+ /*
79
+ * External API so that users can perform search programatically.
80
+ * */
81
+ this.search = function (submittedVal) {
82
+ val = submittedVal;
83
+ e.trigger();
84
+ };
85
+
86
+ /*
87
+ * External API to get the number of matched results as seen in
88
+ * https://github.com/ruiz107/quicksearch/commit/f78dc440b42d95ce9caed1d087174dd4359982d6
89
+ * */
90
+ this.currentMatchedResults = function() {
91
+ return this.matchedResultsCount;
92
+ };
93
+
94
+ this.stripe = function () {
95
+
96
+ if (typeof options.stripeRows === "object" && options.stripeRows !== null)
97
+ {
98
+ var joined = options.stripeRows.join(' ');
99
+ var stripeRows_length = options.stripeRows.length;
100
+
101
+ jq_results.not(':hidden').each(function (i) {
102
+ $(this).removeClass(joined).addClass(options.stripeRows[i % stripeRows_length]);
103
+ });
104
+ }
105
+
106
+ return this;
107
+ };
108
+
109
+ this.strip_html = function (input) {
110
+ var output = input.replace(new RegExp('<[^<]+\>', 'g'), "");
111
+ output = $.trim(output.toLowerCase());
112
+ return output;
113
+ };
114
+
115
+ this.results = function (bool) {
116
+ if (typeof options.noResults === "string" && options.noResults !== "") {
117
+ if (bool) {
118
+ $(options.noResults).hide();
119
+ } else {
120
+ $(options.noResults).show();
121
+ }
122
+ }
123
+ return this;
124
+ };
125
+
126
+ this.loader = function (bool) {
127
+ if (typeof options.loader === "string" && options.loader !== "") {
128
+ (bool) ? $(options.loader).show() : $(options.loader).hide();
129
+ }
130
+ return this;
131
+ };
132
+
133
+ this.cache = function () {
134
+
135
+ jq_results = $(target);
136
+
137
+ if (typeof options.noResults === "string" && options.noResults !== "") {
138
+ jq_results = jq_results.not(options.noResults);
139
+ }
140
+
141
+ var t = (typeof options.selector === "string") ?
142
+ jq_results.find(options.selector) : $(target).not(options.noResults);
143
+ cache = t.map(function () {
144
+ return e.strip_html(this.innerHTML);
145
+ });
146
+
147
+ rowcache = jq_results.map(function () {
148
+ return this;
149
+ });
150
+
151
+ /*
152
+ * Modified fix for sync-ing "val".
153
+ * Original fix https://github.com/michaellwest/quicksearch/commit/4ace4008d079298a01f97f885ba8fa956a9703d1
154
+ * */
155
+ val = val || this.val() || "";
156
+
157
+ return this.go();
158
+ };
159
+
160
+ this.trigger = function () {
161
+ this.loader(true);
162
+ options.onBefore();
163
+
164
+ window.clearTimeout(timeout);
165
+ timeout = window.setTimeout(function () {
166
+ e.go();
167
+ }, options.delay);
168
+
169
+ return this;
170
+ };
171
+
172
+ this.cache();
173
+ this.results(true);
174
+ this.stripe();
175
+ this.loader(false);
176
+
177
+ return this.each(function () {
178
+
179
+ /*
180
+ * Changed from .bind to .on.
181
+ * */
182
+ $(this).on(options.bind, function () {
183
+
184
+ val = $(this).val();
185
+ e.trigger();
186
+ });
187
+ });
188
+
189
+ };
190
+
191
+ }(jQuery, this, document));