Forum
20:13
02/10/2013
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'
});
16:03
Moderators
30/10/2007
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.
11:24
Moderators
30/10/2007
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.
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
Most Users Ever Online: 715
Currently Online:
31 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