jquerypaginationjquery-pagination

How to pass page number to pageClick function in Jquery-Simple pagination


I am using jquery simplePagination.js in my application. I created a function name showProjectPage(pageNumber). It is used to show the particular page with the page number. I used the following code for doing pagination using SimplePagination.js

$(".paging").pagination({
    items: totalItmes,
    itemsOnPage: perPageItem,
    cssStyle: 'light-theme',
    currentPage : currentPageNumber,
    onPageClick : showProjectPage
});

I can call the function usning onPageClick : showProjectPage. How can I pass the pageNumber to this function?


Solution

  • Try this,

    onPageClick : function(){
                showProjectPage(currentPageNumber)
              }
    

    Full Code

    $(".paging").pagination({
        items: totalItmes,
        itemsOnPage: perPageItem,
        cssStyle: 'light-theme',
        currentPage : currentPageNumber,        
        onPageClick : function(){
                showProjectPage(currentPageNumber)
              }
    });