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
Loading last page calls the server multiple times
02/10/2013
20:13
Avatar
cmeldrum
New Member
Members
Forum Posts: 2
Member Since:
02/10/2013
sp_UserOfflineSmall Offline

jqgrid version 4.5.2

I implemented virtual scrolling on a search page (see code below).

Search results returned 64 results. When I scoll to the bottom, I first see "View 1 of 64″. If I scroll up a little and then back to the bottom again, the text changes to "View -3 of 64″ and I see duplicate rows added to the table. If I do this a second time, the text changes to "View -7 of 64″ and additional duplicate rows get added. Subsequent scrolls to the bottom have no further effect.

After a lot of digging, I found what I think was the issue. On line 968 of jquery.jqGrid.src.js

if (p.lastpage && (page > p.lastpage || p.lastpage===1 || (page === p.page && page===p.lastpage)) ) {

    return;

}

page comes in as a string, while p.page and p.lastpage are numbers, so the triple equals in that last part of the if statement always returns false, allowing execution to continue to where the populate function gets called again (twice). It's not until page exceeds the value of p.lastpage that subsequent calls to populate are prevented.

If I change the "===" to "==" the scrolling begins to work as I expect.

Can we get a fix that either sets the type of page to "number" to match the type of p.page and p.lastpage ("number"), or, alternatively, change the "===" to "=="? Or if there's some jqGrid option I can set to get the behavior I'm expecting, please advise.

jqGrid code:

            $('#someTable').jqGrid({
                url: 'some.json',
                datatype: 'json',
                height: '440px',
                shrinkToFit: false,
                headertitles:true,
                width: gridWidth,                
                colNames:[    'Col 1',
                            'Col 2',
                            ...
                colModel:[    {name:'foo',index:'foo', width:170, sortable:false},
                            {name:'bar', width:70, hidden:true},
                            ...
                rowNum:20,
                scroll:1,
                loadonce:false,                
                mtype: "GET",
                viewsortcols: [true,'vertical',true],
                viewrecords: true,
                sortorder: 'desc',
                pager: '#someTablePager'
            });

03/10/2013
16:03
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

First of all thanks for the investigation.

I'm not sure that this is true:

page comes in as a string, while p.page and p.lastpage are numbers, so the triple equals in that last

If you look into the code some lines above you will notice that the page when set is always integer.

It can be possible that some other components are not set correct.

It is very difficult to fix bugs when scroll is set to 1, since every case is uniquie at the client - CCS styles, grid configuratiin, server data and etc.

Can you please provide me a link to the problem using the jqGrid source and not min file?

Thank you very much

Kind 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/10/2013
23:02
Avatar
cmeldrum
New Member
Members
Forum Posts: 2
Member Since:
02/10/2013
sp_UserOfflineSmall Offline

Hi Tony,

I appreciate your quick response.

We're actually going to table virtual scrolling right now and go back to pagination.

Thanks.

Chris

06/10/2013
11:24
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

The very simple test is just to add this line before the if and see the result.

page = parseInt(page,10);

if (p.lastpage && (page > p.lastpage || p.lastpage===1 || (page === p.page && page===p.lastpage)) ) {

    return;

}

Please let me know if this work too for you (I suppose – it will not).

Kind Regards

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.

02/11/2013
05:05
Avatar
jrewing
Member
Members
Forum Posts: 3
Member Since:
16/10/2012
sp_UserOfflineSmall Offline

Hi Tony,

i have a similar problem. I'm using 4.4.1 because i can't update JQuery 🙁

The last Ajax Request is called twice.When i scroll up and down many request are fired.

But only in Firefox 24 and higher - in Chrome all worked fine.

Scroll, 1

Rownum = 100

When you want i can gave you an demo url.

Best regards

Tom

02/11/2013
12:56
Avatar
jrewing
Member
Members
Forum Posts: 3
Member Since:
16/10/2012
sp_UserOfflineSmall Offline

.ui-jqgrid tr.jqgrow {
    outline-style: none;
    height: 27px;
    vertical-align:middle !important;
}

Works for me !

When i used formatter with images i must set an height.

Maybe this helps when somebody have same problems 😉

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
39 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