jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Bug in addForeignKey when server side paging
This topic contains 6 replies, has 2 voices, and was last updated by Christophe Opoix 12 years, 4 months ago.
-
Author
-
When using a dropdownlist in a grid and server side paging, a bug in addForeignKey prevents paging.
The code in addForeignKey seem to ignore the fact that the dataAdapter is pageable.Hi Christophe Opoix,
If you report an issue regarding our products, please include the following information in your post:
– jQuery version, jQWidgets version, device type(PC, Mobile), browser name and version.
– Please, provide step by step instructions on how to reproduce the reported issue and provide a small sample which demonstrates it.Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comjquery 1.8.3
jqwidgets 2.7
chrome PC 20.1446.3 canary
– steps :
– create a grid with server side paging
– a dropdownlist column (as seen in http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm#demos/jqxgrid/gridkeyvaluescolumnwitharray.htm)When paging, an error occurs in addForeignKey. I corrected the minified code with this (the part about start, end and pageable, virtualmode) :
addForeignValues:function(c){ var k=this; var p=c.datafields?c.datafields.length:0; for(var f=0;f<p;f++){ var e=c.datafields[f]; if(e!=undefined){ if(e.values!=undefined){ if(e.value==undefined){ e.value=e.name } if(e.values.value==undefined){ e.values.value=e.value } var n=new Array(); var start, end; if (k.pageable && k.virtualmode) { start = k.pagenum * k.pageSize + 1; end = (k.pagenum + 1) * k.pageSize + 1; if (end > k.totalrecords) { end = k.totalrecords; } } else { start = 0; end = k.records.length; } for(var g=start;g<end;g++){ var h=k.records[g]; var d=e.name;var o=h[e.value]; if(n[o]!=undefined){ h[d]=n[o] } else { for(var f=0;f<e.values.source.length;f++){ var m=e.values.source[f]; var b=m[e.values.value]; if(b==undefined){ b=m.uid} if(b==o){ var l=m[e.values.name]; h[d]=l; n[o]=l; break } } } } }else{ if(e.value!=undefined){ for(var g=0;g<k.records.length;g++){ var h=k.records[g]; h[e.name]=h[e.value] } } } } }},
Sorry, I was too quick on this, the code is more something like :
if (k.pageable && k.virtualmode) { start = k.pagenum * k.pagesize; end = ((k.pagenum + 1) * k.pagesize) - 1; if (end > k.totalrecords) { end = k.totalrecords; } } else { start = 0; end = k.records.length; }
Hi,
the code modified in jqWidgets 2.8 isn’t the correct one, you should use my second snippet (you might want to test though, I can’t guarantee it handles every use case correctly).
Regards,
Christophe Opoix
Hi Christophe Opoix,
The reported issue is already resolved. The second solution posted here is not Ok, too. Not sure when you downloaded the build.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThanks, I redownloaded the build and it works now.
-
AuthorPosts
You must be logged in to reply to this topic.