Forum
I made this change to my grid.base.js of beta 3.5. Haven't updated yet to 3.5.2 to see if anything similar is there. Basically we wanted the page to always reset to page one when length was changed, to avoid mismatch situations. You might want something similar as a configurable option.
$('.ui-pg-selbox',”#”+pgcnt).bind('change',function() {
ts.p.rowNum = this.value;
// Begin change
$('input.ui-pg-input').val(1);
ts.p.page = 1;
// End change
clearVals('records');
populate();
return false;
});
10:34
10/08/2009
Hello edallen!
I wanted to post following in the "bugs" part of forum, but after read your mail I deceide to make it here. It seems to me, that my solution is a little better.
I suggest insert in grid.base.js between lines 802 and 803:
$('.ui-pg-selbox',"#"+pgcnt).bind('change',function() {
ts.p.rowNum = this.value;
following new line
ts.p.page = Math.round(ts.p.rowNum*(ts.p.page-1)/this.value-0.5)+1;
(ts.p.rowNum*(ts.p.page-1) - is the number of rows currently skiped.
ts.p.rowNum*(ts.p.page-1)/this.value - is the number of pages which sould be skipt, but as a float number. Math.round(x-0.5) is truncation instead of round. And +1 at the end becasue we count bages begins with 1)
I describe shortly what problem fixes the line.
Let as we have a grid with pager und rowList=[10,20,100]. At the beginning the first 10 rows of the data loaded and displayed. User press 2 times the button “next page” and stay on page 3 from 5 totally. Now user decides to scroll better in 20 steps or in 100 steps. He changes pager size (rowNum) from 10 to 20 or 100 and receive a message, that there are no data to display. The reason was that after changing the pager size (rowNum), the current page number (page) stays unchanged and so will be requested from server to load data from the wrong page. To fix the problem one should either reset page value to 1 or recomputed the page value.
Regards
Oleg
10:55
Moderators
30/10/2007
Hello,
Thanks Oleg - this definitley usefull. Will make some tests and include in the next releases.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
03:38
10/08/2009
Hi Tony,
A small remark. In the current version on GitHub the lines 816 and 817 in grid.base.js should be swaped. Correct code should be:
...
$('.ui-pg-selbox',"#"+pgcnt).bind('change',function() {
ts.p.page = Math.round(ts.p.rowNum*(ts.p.page-1)/this.value-0.5)+1;
ts.p.rowNum = this.value;
...
Best regards
Oleg
10:11
Moderators
30/10/2007
Hello Oleg,
Done. Thanks.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
49 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66