Search code examples
jqgrid

how to control Mobile jqGrid shrinkToFit


I want to do jqGrid shrinkToFit:false on screens of more than 320px and less than 768px. For 769px screens, I want to use shrinkToFit:true.


Solution

  • You can try this code:

    function shrinkToFitPixels() {
       var sreenwidth = window.screen.width * window.devicePixelRatio;
       if( sreenwidth >= 320 && sreenwidth <= 768 ) {
          return false;
       } else {
          return true;
       }
    }
    
    $("#grid").jqGrid({
    ...
       shrinkToFit : shrinkToFitPixels(),
    ...
    });