From bb939266a85e5fff941775bda47ac748c8b20d53 Mon Sep 17 00:00:00 2001 From: Mottie Date: Thu, 31 Jul 2014 07:42:21 -0500 Subject: [PATCH] Pager: remove selected attribute from page options. See #700 --- addons/pager/jquery.tablesorter.pager.js | 2 ++ docs/example-pager-filtered.html | 4 ++-- docs/example-pager.html | 2 +- docs/example-widget-pager.html | 2 +- docs/index.html | 2 +- js/widgets/widget-pager.js | 2 ++ 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index 574d0328..68eb8077 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -842,6 +842,8 @@ // page size selector p.$size = pager.find(p.cssPageSize); if ( p.$size.length ) { + // setting an option as selected appears to cause issues with initial page size + p.$size.find('option').removeAttr('selected'); p.$size.unbind('change.pager').bind('change.pager', function() { p.$size.val( $(this).val() ); // in case there are more than one pagers if ( !$(this).hasClass(p.cssDisabled) ) { diff --git a/docs/example-pager-filtered.html b/docs/example-pager-filtered.html index a831631f..779806df 100644 --- a/docs/example-pager-filtered.html +++ b/docs/example-pager-filtered.html @@ -153,7 +153,7 @@ Next Last - + diff --git a/docs/example-pager.html b/docs/example-pager.html index bb0e4cf9..fceeaae0 100644 --- a/docs/example-pager.html +++ b/docs/example-pager.html @@ -588,7 +588,7 @@ td.tablesorter-pager { <img src="next.png" class="next"/> <img src="last.png" class="last"/> <select class="pagesize"> - <option selected="selected" value="10">10</option> + <option value="10">10</option> <option value="20">20</option> <option value="30">30</option> <option value="40">40</option> diff --git a/docs/example-widget-pager.html b/docs/example-widget-pager.html index 9bb5a115..0f122b0c 100644 --- a/docs/example-widget-pager.html +++ b/docs/example-widget-pager.html @@ -625,7 +625,7 @@ td.tablesorter-pager { <img src="next.png" class="next"/> <img src="last.png" class="last"/> <select class="pagesize"> - <option selected="selected" value="10">10</option> + <option value="10">10</option> <option value="20">20</option> <option value="30">30</option> <option value="40">40</option> diff --git a/docs/index.html b/docs/index.html index af21e000..c9b51cf7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3131,7 +3131,7 @@ $.extend($.tablesorter.themes.jui, { <img src="next.png" class="next"/> <img src="last.png" class="last"/> <select class="pagesize"> - <option selected="selected" value="10">10</option> + <option value="10">10</option> <option value="20">20</option> <option value="30">30</option> <option value="40">40</option> diff --git a/js/widgets/widget-pager.js b/js/widgets/widget-pager.js index 0e28c6e8..ea5f036e 100644 --- a/js/widgets/widget-pager.js +++ b/js/widgets/widget-pager.js @@ -306,6 +306,8 @@ tsp = ts.pager = { } if ( p.$size.length ) { + // setting an option as selected appears to cause issues with initial page size + p.$size.find('option').removeAttr('selected'); p.$size .unbind('change.pager') .bind('change.pager', function() {