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.