Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix for issue #27 - pager should not include childrows

  • Loading branch information...
commit 580f4e548d9017f8a304383e972fcf225e6241e8 1 parent 12cf467
@Mottie authored
View
52 README.markdown
@@ -34,7 +34,11 @@ Included all original [document pages](http://mottie.github.com/tablesorter/docs
View the [complete listing here](http://mottie.github.com/tablesorter/changelog.txt).
-####Version 2.0.28 (2012-2-1)
+#### Version 2.0.28.1 (2012-2-16)
+
+* Modified the plugin pager to ignore child rows. Fix for [issue #27](https://github.com/Mottie/tablesorter/issues/27).
+
+#### Version 2.0.28 (2012-2-1)
* Added a new function to widgets called "init" which is called upon initialization, before any of the widgets are applied.
* I added it to allow the "saveSort" widget to get the saved sort data (localStorage or cookie) before the initial sort was applied.
@@ -58,7 +62,7 @@ View the [complete listing here](http://mottie.github.com/tablesorter/changelog.
});
```
-####Version 2.0.27 (2012-1-31)
+#### Version 2.0.27 (2012-1-31)
* Added `sortReset` option
* Setting this option to `true`, allows you to click on the header a third time to clear the sort
@@ -68,7 +72,7 @@ View the [complete listing here](http://mottie.github.com/tablesorter/changelog.
* The widget does use the `JSON.stringify` function which is [not fully supported](http://caniuse.com/#search=json) (IE7), so if you plan to support it and use this widget, please include this [JSON library](https://github.com/douglascrockford/JSON-js).
* Fixed pager page size not sticking. Fix for [issue #24](https://github.com/Mottie/tablesorter/issues/24).
-####Version 2.0.26 (2012-1-30)
+#### Version 2.0.26 (2012-1-30)
* Widgets should no longer be applied twice when an initial sort direction is added. Fix for [issue #21](https://github.com/Mottie/tablesorter/issues/21).
* Modified Green theme:
@@ -76,52 +80,16 @@ View the [complete listing here](http://mottie.github.com/tablesorter/changelog.
* Essentially to fix [this demo](http://mottie.github.com/tablesorter/docs/example-widget-ui-theme.html) which allows switching between all of the themes.
* Modified the UI theme to now add a div that wraps all of the header cell content to allow positioning of the sort direction icon.
-####Version 2.0.25.2 (2012-1-27)
+#### Version 2.0.25.2 (2012-1-27)
* Changed Blue theme to vertically align arrows. Fix for [issue #12](https://github.com/Mottie/tablesorter/issues/12).
* Fixed sticky header widget so varing width columns now update when the pager plugin changes pages. Thanks to locationRoura for reporting this issue.
-####Version 2.0.25.1 (2011-12-15)
+#### Version 2.0.25.1 (2011-12-15)
* Fixed disabled column style for the ui theme widget. Thanks to [bbbco](https://github.com/bbbco) for the fix in [issue #17](https://github.com/Mottie/tablesorter/issues/17).
-####Version 2.0.25 (2011-12-14)
+#### Version 2.0.25 (2011-12-14)
* The ui theme and sticky header widgets now work together and update the arrow direction. Fix for [issue #15](https://github.com/Mottie/tablesorter/issues/15).
* Empty cells with only a tab or space will now sort at the bottom. Thanks to [pursual](https://github.com/pursual) for the fix for [issue #16](https://github.com/Mottie/tablesorter/issues/16).
-
-####Version 2.0.24 (2011-12-12)
-
-* Modified empty cell sorting to always sort at the bottom. Fix for [issue #14](https://github.com/Mottie/tablesorter/issues/14).
-* Updated the sticky header widget to line up properly with the UI theme. Fix for [issue #13](https://github.com/Mottie/tablesorter/issues/13).
-
-####Version 2.0.23.5 (2011-12-6)
-
-* Updated the sticky header widget again to not interfere with the filter widget. Fix for [issue #10](https://github.com/Mottie/tablesorter/issues/10).
-
-####Version 2.0.23.4 (2011-12-6)
-
-* Updated the sticky header widget to reposition the sticky header when scrolling left. Fix for [issue #9](https://github.com/Mottie/tablesorter/issues/9).
-
-#### Version 2.0.23.3 (2011-11-7)
-
-* Updated the filter widget:
- * Changed filter input from visibility hidden to display none. Fix/enhancement from [issue #7](https://github.com/Mottie/tablesorter/issues/7).
- * Modified the widget to better work with child rows. Added the `widgetFilterChildRows` option. Fix for [issue #8](https://github.com/Mottie/tablesorter/issues/8).
- * When `widgetFilterChildRows` is true, all child row content is included in the row filtering; if false, the child row content is ignored.
-* Added `tableClass` to the documents. Apparently I forgot to add it before.
-* Added a note to the filter demo bringing up [issue #6](https://github.com/Mottie/tablesorter/issues/6).
-* Miscellaneous updates to the documents.
-
-#### Version 2.0.23.2 (2011-10-28)
-
-* Fixed pager size & total pages not being retained after destroying, then restoring the pager. Thanks to crush123 for reporting the problem!
-
-#### Version 2.0.23.1 (2011-10-26)
-
-* Fixed the pager plugin to prevent errors when initialized on an empty table. Fix for [issue #5](https://github.com/Mottie/tablesorter/issues/5).
-* Added a Resizable Column widget
- * At this time, this widget allows resizing the column widths from the header.
- * The column widths are not saved, but if I did consider saving the widths to local storage. I just didn't get around to doing it.
- * [Demo page](http://mottie.github.com/tablesorter/docs/example-widget-resizable.html) added.
-* Reorganized the next demo links, located at the bottom of every demo page, to match the order on the main document page.
View
4 addons/pager/jquery.tablesorter.pager.js
@@ -1,6 +1,6 @@
/*
* tablesorter pager plugin
- * updated 1/31/2012
+ * updated 2/16/2012
*/
(function($) {
@@ -54,7 +54,7 @@
},
hideRows = function(table, c){
- var i, rows = $('tr', table.tBodies[0]),
+ var i, rows = $('tr:not(.' + c.cssChildRow + ')', table.tBodies[0]),
l = rows.length,
s = (c.page * c.size),
e = (s + c.size);
View
4 addons/pager/jquery.tablesorter.pager.min.js
@@ -1,2 +1,2 @@
-/* tablesorter pager plugin - updated 1/31/2012 */
-(function(d){d.extend({tablesorterPager:new function(){var m=function(c){var a=c.cssDisabled;c.updateArrows&&(c.container[c.totalRows<c.size?"addClass":"removeClass"](a),d(c.cssFirst+","+c.cssPrev,c.container)[0===c.page?"addClass":"removeClass"](a),d(c.cssNext+","+c.cssLast,c.container)[c.page===c.totalPages-1?"addClass":"removeClass"](a))},q=function(c,a){a.startRow=a.size*a.page+1;a.endRow=Math.min(a.totalRows,a.size*(a.page+1));var b=d(a.cssPageDisplay,a.container),e=a.output.replace(/\{(page|totalPages|startRow|endRow|totalRows)\}/gi, function(b){return{"{page}":a.page+1,"{totalPages}":a.totalPages,"{startRow}":a.startRow,"{endRow}":a.endRow,"{totalRows}":a.totalRows}[b]});"INPUT"===b[0].tagName?b.val(e):b.html(e);m(a);a.container.show();d(c).trigger("pagerComplete",a)},n=function(c,a){var b=d(c);!a.pagerPositionSet&&a.positionFixed&&(b.offset&&a.container.css({top:b.offset().top+b.height()+a.offset+"px",position:"absolute"}),a.pagerPositionSet=!0)},j=function(c,a){var b,e=d("tr",c.tBodies[0]),g=e.length,f=a.page*a.size,i=f+a.size; i>g&&(i=g);for(b=0;b<g;b++)e[b].style.display=b>=f&&b<i?"":"none"},o=function(c,a){a.size=a.lastSize=parseInt(d(a.cssPageSize,a.container).val(),10);m(a);a.removeRows||(j(c,a),d(c).bind("sortEnd.pager",function(){j(c,a);d(c).trigger("applyWidgets")}))},h=function(c,a,b){var e,g,h,i=d(c.tBodies[0]),k=a.length;e=b.page*b.size;var l=e+b.size;if(!(1>k)){d(c).trigger("pagerChange",b);if(b.removeRows){l>a.length&&(l=a.length);for(d.tablesorter.clearTableBody(c);e<l;e++){h=a[e];k=h.length;for(g=0;g<k;g++)i[0].appendChild(h[g])}}else j(c, b);n(c,i,b);d(c).trigger("applyWidgets");b.page>=b.totalPages&&(b.page=b.totalPages-1,f(c,b));q(c,b)}},p=function(c,a){a.lastPage=a.page;a.lastSize=a.size;a.size=a.totalRows;a.totalPages=1;h(c,a.rowsCopy,a)},f=function(c,a){if(!a.isDisabled){if(0>a.page||a.page>a.totalPages-1)a.page=0;h(c,a.rowsCopy,a)}};this.appender=function(c,a){var b=c.config;b.rowsCopy=a;b.totalRows=a.length;b.size=b.lastSize||b.size;b.totalPages=Math.ceil(b.totalRows/b.size);h(c,a,b)};this.defaults={container:null,output:"{startRow} to {endRow} of {totalRows} rows", updateArrows:!0,page:0,size:10,positionFixed:!0,offset:0,removeRows:!0,cssNext:".next",cssPrev:".prev",cssFirst:".first",cssLast:".last",cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssDisabled:"disabled",totalRows:0,totalPages:0,appender:this.appender};this.construct=function(c){return this.each(function(){var a=d.extend(this.config,d.tablesorterPager.defaults,c),b=this,e=a.container;d(this).trigger("appendCache");o(b,a);d(a.cssFirst,e).unbind("click.pager").bind("click.pager",function(){a.page= 0;f(b,a);return!1});d(a.cssNext,e).unbind("click.pager").bind("click.pager",function(){a.page++;a.page>=a.totalPages-1&&(a.page=a.totalPages-1);f(b,a);return!1});d(a.cssPrev,e).unbind("click.pager").bind("click.pager",function(){a.page--;0>=a.page&&(a.page=0);f(b,a);return!1});d(a.cssLast,e).unbind("click.pager").bind("click.pager",function(){a.page=a.totalPages-1;f(b,a);return!1});d(a.cssPageSize,e).unbind("change.pager").bind("change.pager",function(){var c=parseInt(d(this).val(),10);a.size=a.lastSize= c;a.totalPages=Math.ceil(a.totalRows/a.size);a.pagerPositionSet=!1;f(b,a);n(b,a);return!1});d(this).unbind("disable.pager enable.pager destroy.pager").bind("disable.pager",function(){a.isDisabled=!0;p(b,a)}).bind("enable.pager",function(){a.isDisabled=!1;d("table").trigger("update");a.page=a.lastPage||0;a.totalPages=Math.ceil(a.totalRows/a.size);o(b,a)}).bind("destroy.pager",function(){p(b,a);a.container.hide();a.appender=null;d(b).unbind("destroy.pager sortEnd.pager enable.pager disable.pager")})})}}}); d.fn.extend({tablesorterPager:d.tablesorterPager.construct})})(jQuery);
+/* tablesorter pager plugin - updated 2/16/2012 */
+(function(d){d.extend({tablesorterPager:new function(){var m=function(c){var a=c.cssDisabled;c.updateArrows&&(c.container[c.totalRows<c.size?"addClass":"removeClass"](a),d(c.cssFirst+","+c.cssPrev,c.container)[0===c.page?"addClass":"removeClass"](a),d(c.cssNext+","+c.cssLast,c.container)[c.page===c.totalPages-1?"addClass":"removeClass"](a))},q=function(c,a){a.startRow=a.size*a.page+1;a.endRow=Math.min(a.totalRows,a.size*(a.page+1));var b=d(a.cssPageDisplay,a.container),e=a.output.replace(/\{(page|totalPages|startRow|endRow|totalRows)\}/gi, function(b){return{"{page}":a.page+1,"{totalPages}":a.totalPages,"{startRow}":a.startRow,"{endRow}":a.endRow,"{totalRows}":a.totalRows}[b]});"INPUT"===b[0].tagName?b.val(e):b.html(e);m(a);a.container.show();d(c).trigger("pagerComplete",a)},n=function(c,a){var b=d(c);!a.pagerPositionSet&&a.positionFixed&&(b.offset&&a.container.css({top:b.offset().top+b.height()+a.offset+"px",position:"absolute"}),a.pagerPositionSet=!0)},j=function(c,a){var b,e=d("tr:not(."+a.cssChildRow+")",c.tBodies[0]),g=e.length, f=a.page*a.size,i=f+a.size;i>g&&(i=g);for(b=0;b<g;b++)e[b].style.display=b>=f&&b<i?"":"none"},o=function(c,a){a.size=a.lastSize=parseInt(d(a.cssPageSize,a.container).val(),10);m(a);a.removeRows||(j(c,a),d(c).bind("sortEnd.pager",function(){j(c,a);d(c).trigger("applyWidgets")}))},h=function(c,a,b){var e,g,h,i=d(c.tBodies[0]),k=a.length;e=b.page*b.size;var l=e+b.size;if(!(1>k)){d(c).trigger("pagerChange",b);if(b.removeRows){l>a.length&&(l=a.length);for(d.tablesorter.clearTableBody(c);e<l;e++){h=a[e]; k=h.length;for(g=0;g<k;g++)i[0].appendChild(h[g])}}else j(c,b);n(c,i,b);d(c).trigger("applyWidgets");b.page>=b.totalPages&&(b.page=b.totalPages-1,f(c,b));q(c,b)}},p=function(c,a){a.lastPage=a.page;a.lastSize=a.size;a.size=a.totalRows;a.totalPages=1;h(c,a.rowsCopy,a)},f=function(c,a){if(!a.isDisabled){if(0>a.page||a.page>a.totalPages-1)a.page=0;h(c,a.rowsCopy,a)}};this.appender=function(c,a){var b=c.config;b.rowsCopy=a;b.totalRows=a.length;b.size=b.lastSize||b.size;b.totalPages=Math.ceil(b.totalRows/ b.size);h(c,a,b)};this.defaults={container:null,output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,size:10,positionFixed:!0,offset:0,removeRows:!0,cssNext:".next",cssPrev:".prev",cssFirst:".first",cssLast:".last",cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssDisabled:"disabled",totalRows:0,totalPages:0,appender:this.appender};this.construct=function(c){return this.each(function(){var a=d.extend(this.config,d.tablesorterPager.defaults,c),b=this,e=a.container;d(this).trigger("appendCache"); o(b,a);d(a.cssFirst,e).unbind("click.pager").bind("click.pager",function(){a.page=0;f(b,a);return!1});d(a.cssNext,e).unbind("click.pager").bind("click.pager",function(){a.page++;a.page>=a.totalPages-1&&(a.page=a.totalPages-1);f(b,a);return!1});d(a.cssPrev,e).unbind("click.pager").bind("click.pager",function(){a.page--;0>=a.page&&(a.page=0);f(b,a);return!1});d(a.cssLast,e).unbind("click.pager").bind("click.pager",function(){a.page=a.totalPages-1;f(b,a);return!1});d(a.cssPageSize,e).unbind("change.pager").bind("change.pager", function(){var c=parseInt(d(this).val(),10);a.size=a.lastSize=c;a.totalPages=Math.ceil(a.totalRows/a.size);a.pagerPositionSet=!1;f(b,a);n(b,a);return!1});d(this).unbind("disable.pager enable.pager destroy.pager").bind("disable.pager",function(){a.isDisabled=!0;p(b,a)}).bind("enable.pager",function(){a.isDisabled=!1;d("table").trigger("update");a.page=a.lastPage||0;a.totalPages=Math.ceil(a.totalRows/a.size);o(b,a)}).bind("destroy.pager",function(){p(b,a);a.container.hide();a.appender=null;d(b).unbind("destroy.pager sortEnd.pager enable.pager disable.pager")})})}}}); d.fn.extend({tablesorterPager:d.tablesorterPager.construct})})(jQuery);
View
5 changelog.txt
@@ -1,5 +1,10 @@
TableSorter Change Log
+Version 2.0.28.1 (2012-2-16)
+============================
+
+* Modified the plugin pager to ignore child rows. Fix for [issue #27](https://github.com/Mottie/tablesorter/issues/27).
+
Version 2.0.28 (2012-2-1)
============================
View
27 docs/example-widgets.html
@@ -23,6 +23,7 @@
<script id="js">$(function() {
// add new widget called repeatHeaders
+ // ************************************
$.tablesorter.addWidget({
// give the widget an id
@@ -54,7 +55,6 @@
);
}
}
-
}
});
@@ -315,6 +315,31 @@
<h1>Javascript</h1>
+ <h3>Add Widget Template</h3>
+ <div>
+ <pre class="js">// addWidget Template
+// *******************
+$.tablesorter.addWidget({
+ id: 'myWidget',
+ // The init function (added in v2.0.28) is called only after tablesorter has
+ // initialized, but before initial sort & before any of the widgets are applied.
+ init: function(table, allWidgets, thisWidget){
+ // widget initialization code - this is only *RUN ONCE*
+ // but in this example, only the format function is called to from here
+ // to keep the widget backwards compatible with the original tablesorter
+ thisWidget.format(table, true);
+ },
+ format: function(table, initFlag) {
+ // widget code to apply to the table *AFTER EACH SORT*
+ // the initFlag is true when this format is called from the init
+ // function above otherwise initFlag is undefined
+ // * see the saveSort widget for a full example *
+ }
+});</pre>
+ </div>
+
+ <h3>Repeat Headers Widget Code</h3>
+
<div id="javascript">
<pre class="js"></pre>
</div>
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "tablesorter",
- "version": "2.0.28",
+ "version": "2.0.28.1",
"title": "tablesorter",
"author": {
"name": "Christian Bach",
Please sign in to comment.
Something went wrong with that request. Please try again.