admin管理员组文章数量:1417061
I have tables that are dynamically loaded via AJAX. Every time a new table loads, I want to reset the page size to the default value. However, currently it is being set to the previously chosen drop-down value.
Currently, every time a new table is loaded I am doing the following:
$(".pagesize").val(20);
$("#data_table").tablesorter().tablesorterPager({container: $("#pager"), size:20});
However, the page size is being set to the last selected value. For e.g. with the options 20, 40, 80 and All, if I choose 80 for a table and then load a new table along with the above lines of codes, it is still being set to 80 instead of 20.
Does tablesorter store the previously used values? Why am I not able to reset the value.
I tried changing the value of dropdown in tablesorter pager example, and noticed that the selected option does not change in the select tag. In the attached image, I changed the page size from 10 to 20, however it did not change the selection option in the select tag as can be seen in the Google Dev Tool.
I have tables that are dynamically loaded via AJAX. Every time a new table loads, I want to reset the page size to the default value. However, currently it is being set to the previously chosen drop-down value.
Currently, every time a new table is loaded I am doing the following:
$(".pagesize").val(20);
$("#data_table").tablesorter().tablesorterPager({container: $("#pager"), size:20});
However, the page size is being set to the last selected value. For e.g. with the options 20, 40, 80 and All, if I choose 80 for a table and then load a new table along with the above lines of codes, it is still being set to 80 instead of 20.
Does tablesorter store the previously used values? Why am I not able to reset the value.
I tried changing the value of dropdown in tablesorter pager example, and noticed that the selected option does not change in the select tag. In the attached image, I changed the page size from 10 to 20, however it did not change the selection option in the select tag as can be seen in the Google Dev Tool.
Share Improve this question edited Aug 19, 2014 at 19:30 Alagappan Ramu asked Aug 19, 2014 at 19:06 Alagappan RamuAlagappan Ramu 2,3687 gold badges27 silver badges38 bronze badges1 Answer
Reset to default 7The original version of tablesorter does not have methods in place to allow this... if you switch to my fork of tablesorter, you can use the following mand to set the page size.
$('table').trigger('pageSize', 15);
There is also a savePages
option (default set to true
) which saves the user set page size.
Updating requires a minimal amount of option changes, if any, to make it work.
本文标签: javascriptHow to reset Tablesorter page sizeStack Overflow
版权声明:本文标题:javascript - How to reset Tablesorter page size - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745258388a2650240.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论