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.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author

  • Christophe Opoix
    Participant

    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.


    Peter Stoev
    Keymaster

    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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Christophe Opoix
    Participant

    jquery 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]
    }
    }
    }
    }
    }
    },

    Christophe Opoix
    Participant

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

    Christophe Opoix
    Participant

    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


    Peter Stoev
    Keymaster

    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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Christophe Opoix
    Participant

    Thanks, I redownloaded the build and it works now.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.