jqGrid随窗口大小变化自适应大小的示例代码

第一种: jqGrid随窗口大小变化自适应宽度 $(function(){            $(window).resize(function(){            $("#listId").setGridWidth($(window).width());        });       }); 第二种: wind

第一种:

jqGrid随窗口大小变化自适应宽度

  1. $(function(){
  2.             $(window).resize(function(){  
  3.          $("#listId").setGridWidth($(window).width());
  4.         });
  5.        });
复制

第二种:
  1. window.onresize = function  _doResize() {
  2.  var ss = pageSize();
  3.  $("#listId").jqGrid('setGridWidth', ss.WinW-10).jqGrid('setGridHeight', ss.WinH-200);
  4.    }
  5.  function pageSize() {
  6.    var winW, winH;
  7.   if(window.innerHeight) {// all except IE
  8.    winW = window.innerWidth;
  9.    winH = window.innerHeight;
  10.   } else if (document.documentElement && document.documentElement.clientHeight) {// IE 6 Strict Mode
  11.    winW = document.documentElement.clientWidth;
  12.    winH = document.documentElement.clientHeight;
  13.   } else if (document.body) { // other
  14.    winW = document.body.clientWidth;
  15.    winH = document.body.clientHeight;
  16.   }  // for small pages with total size less then the viewport
  17.   return {WinW:winW, WinH:winH};
  18. } 
复制

results matching ""

    No results matching ""