Slim
Slim

Reputation: 1744

Can't get the current page as parameter when the next button is clicked

I'm trying to get the page number as a parameter when the next button is clicked.

I'm trying to achieve it using the below code:

onPaging: function(pgButton) {
    if(pgButton == "next") {
        window.alert("next clicked! \n page: " + 
                     $('#userlist').getGridParam('page'));
    }
}

without any success(with the above code the next button is not working). I'm sure that I'm missing something really simple. Is there a specific place in the grid code, where I should place my code?

Upvotes: 3

Views: 262

Answers (2)

Kris
Kris

Reputation: 1902

Try this

onPaging: function(pgButton){ if(pgButton=="next_your_paging_tool_id"){ window.alert("next clicked! \n page: " + $('#userlist').getGridParam('page')); } },

append the ID of your paging tool ID with a _ in your if condition as in the code posted

Upvotes: 1

Moritz Petersen
Moritz Petersen

Reputation: 13057

pgButton is a String. You should write if (pgButton == "next"). See: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:pager#events

Upvotes: 1

Related Questions