jQWidgets Forums

jQuery UI Widgets Forums Grid virtualmode switching dynamically

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 9 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • virtualmode switching dynamically #84403

    dougcurl
    Participant

    I want to change the virtualmode dynamically by querying for the # of records and determining whether the grid should be rendered in virtualmode or not. My issue is that once I set the virtualmode = true, I can’t go back and set to virtualmode = false again (it stays true). I’m using a code like this. I count the number of records using a dataAdapter and then based on the return of “virtualize” I set the virtualmode for the jqxGrid:

    ` //the results data adapter:
    var dataAdapter = new $.jqx.dataAdapter(source)
    //the count data adapter:
    var dataAdapter_cnt = new $.jqx.dataAdapter(cnt_source,{
    loadComplete: function(data){
    (data.virtualize == 0) ? virtualize = false : virtualize = true
    if(virtualize){
    $(“#results_grid”).jqxGrid({
    virtualmode: virtualize,
    rendergridrows: function(obj){
    return obj.data;
    }
    });
    }

    $(“#results_grid”).jqxGrid({
    source:dataAdapter,
    columnsresize:true
    });
    }
    });

    I don’t have to do this, and maybe there is a better way. I’m inclined just to use virtualmode = true all the time, but I thought it would be nice to give users all the results if a smaller number is returned, plus it results in fewer hits on my server.

    virtualmode switching dynamically #84417

    Peter Stoev
    Keymaster

    Hi dougcurl,

    You can’t change this as it’s fundamental in the Grid’s initialization. It can be either virtual or not.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.