Reputation: 471
I am using the jqPagination from Ben Everard. It's a nice plugin and saved me coding pagination logic.
I have a search and a button ,when a user enters a value and clicks the button I do Ajax search and the following to update the paginator:
$('#search-by-quote-id-paginator').jqPagination('option', 'current_page', 1);
$('#search-by-quote-id-paginator').jqPagination('option', 'max_page', totalpages);
(This required because on the screen the paginator may be showing the "page x of xxx". Since the user has launched a new search by entering in the search box and pressed the button. )
However each of those lines triggers a page: event and my page: function gets executed. How can I turn off triggering of the "page:" event selectively , I want it to happen only on the following line:
$('#search-by-quote-id-paginator').jqPagination('option', 'current_page', 1);
so I want to turn it off for the following line
$('#search-by-quote-id-paginator').jqPagination('option', 'max_page', totalpages);
Thanks !
Harinder
Upvotes: 1
Views: 1081
Reputation: 13804
This issue has now been fixed in version 1.3 of the plugin.
You can now set multiple options with one call to the option
function, this includes the option to not trigger the paged()
callback:
$(".pagination").jqPagination("option", {
max_page : 1,
current_page : 50,
trigger : false
});
Upvotes: 3
Reputation: 471
Thanks for the update.
I have turned off the paged event for the 'max_page' by changing the following line in the function base.setMaxPage = function (max_page) in the jquery.jqpagination.js :
// update the input element
base.updateInput();
was changed to ...
// update the input element
base.updateInput(true);
Thanks ! Harinder
Upvotes: 0