简体   繁体   中英

How to turn off “page” event seletively

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

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
});

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM