0

In the jqgrid 4.4.4 $("#myGrid").getGridParam("page"); to get the page number that user entered in the pagination text box.

But it returns the page number that was already present in that pagination text box.

Note: In the jqgrid 3.7.2 (+ jquery 1.4.2) it was working fine(ie returning the user entered value)

Anyone have suggestions and workarounds ?

(Now I am using jquery version 1.9.0 + jqgrid 4.4.4)

  • When (from which jqGrid callback) you need to get the value of the pagination text box? – Oleg Mar 27 '13 at 13:51
  • I found later [your post](http://www.trirand.com/blog/?page_id=393/bugs/jqgrid-4-4-4-mygrid-getgridparampage-not-returning-proper-value/#p28540) on trirand forum where you described that you need get the information inside of `onPaging` callback. Look at [the answer](http://stackoverflow.com/a/10918290/315935) and [this one](http://stackoverflow.com/a/9733097/315935). I think it's what you needs. The only small problem which you can have if you use *two* pagers (see my comment to the answer of Mark) – Oleg Mar 27 '13 at 15:07
  • Thanks @Mark and Oleg for response – user1085077 Mar 28 '13 at 06:57

2 Answers2

0

The following will give you the value:

$(".ui-pg-input").val();
Mark
  • 3,123
  • 4
  • 20
  • 31
  • Probably `$($("#myGrid").jqGrid("getGridParam", "pager") + " .ui-pg-input").val();` will be more correct? You should don't forget that it could be *more as one grid* on the page. Moreover one grid could have *two* pagers: one defined by `pager` parameter and another one if `toppager: true` were used. – Oleg Mar 27 '13 at 14:26
  • @Oleg I was thinking of adding in the extra to specify a particular grid, but chose not to as I thought it might has been seen as elementary. I was unaware of the toppager...something else to test. – Mark Mar 27 '13 at 15:10
  • Toppager is very simple and practical thing. Look at [the answer](http://stackoverflow.com/a/4402903/315935), [this one](http://stackoverflow.com/a/3557663/315935) and [another one](http://stackoverflow.com/a/5524152/315935). – Oleg Mar 27 '13 at 15:27
  • @Oleg In my grid i have two pagination one top and another bottom of the Grid. If I use $(".ui-pg-input").val() it returns the page no entered in top pagination text box. – user1085077 Mar 28 '13 at 06:42
  • jq(jq("#dataGrid").jqGrid("getGridParam", "toppager") + " .ui-pg-input").val() ==> Gives text entered in top pagination text box jq(jq("#dataGrid").jqGrid("getGridParam", "pager") + " .ui-pg-input").val() ==> Gives text entered in the bottom pagination text box But what is my requirement is if user types page number is top pagination text box and press enter i should text in the top textbox if user types page number is bottom pagination text box and press enter i should text in the bottom textbox – user1085077 Mar 28 '13 at 06:49
  • It effectively boils down to the point... in the onPaging callback, I should know which text box (top pagination text box OR bottom pagination text box) was in focus, when user press ENTER – user1085077 Mar 28 '13 at 06:54
  • Just to reiterate again, in jqgrid 3.7.2 $("#myGrid").getGridParam("page") was giving expected values correctly and works like a charm. Is there any related API behavior changed in later jqgrid – user1085077 Mar 28 '13 at 06:56
  • @user1085077 You could read over the documentation but I didn't see anything about this. You could compare the values from both pagers against the `$("#dataGrid").jqGrid("getGridParam", "pager")` to see which one was changed. – Mark Mar 28 '13 at 14:21
0

this issue is occuring to my after upgrade to 4.4.4. The cause of the issue is basically the comit https://github.com/tonytomov/jqGrid/commit/3e4aa0f2fdcb8c2c2a17e842899aca6d1000410a

This commit changes the onpagin to execute BEFORE grid page calculation. In my current project I have reverted this lines so my pagination works again (I use external source binding). I propose to implement onBeforePaging and onAfterPaging, and each users can attach to the event they wants.

moledj
  • 31
  • 3