I have JQGrid in my application. If i wanted to capture the user input from Pagination's page number text box, what i have to do? And also i wanted to do it before grid changes it's page.
Is there any way to do it? Please, somebody help me to implement this.
You can use onPaging callback If is's needed you can event stop changing of the page. In case of direct user input the parameter of callback will be the string "user"
. To get the current value you can use either page
parameter or get or set the value directly from the input control
onPaging: function (pgButton) {
var pagerId = this.p.pager.substr(1); // ger paper id like "pager"
var newValue = $('input.ui-pg-input', "#pg_" + $.jgrid.jqID(pagerId)).val();
// newValue is in the most cases the same as in this.p.page
// only wrong values like -10 entered by user will not update
// "page" parameter
if (pgButton === "user" && newValue > 2) { // some tests
return "stop";
}
}
UPDATED: Free jqGrid don't have the described above problem. See the wiki article which describes additional options
parameter of onPaging
callback, which has newPage
, currentPage
and some other properties.
I was facing same problem. I need to pass page number manually.
I found this code from another post I dont remeber :p.
Hope it will be help full
$("#GridId").getGridParam('page')