Reputation: 1744
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
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
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