Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Setting page number to 1 when changing page length
18/08/2009
16:44
Avatar
edallen
New Member
Members
Forum Posts: 1
Member Since:
18/08/2009
sp_UserOfflineSmall Offline

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;
            });

22/08/2009
10:34
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

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

31/08/2009
10:55
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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/09/2009
03:38
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

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

03/09/2009
10:11
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information