`

jqGrid自动适应窗口大小

 
阅读更多

$(window).resize(function(){ 
    $("#dataDictList").setGridWidth($(window).width()-7);
});



下面转的
window.onresize = function  _doResize() {
var ss = pageSize();
$("#listId").jqGrid('setGridWidth', ss.WinW-10).jqGrid('setGridHeight', ss.WinH-200);
   }
 
function pageSize() {
   var winW, winH;
  if(window.innerHeight) {// all except IE
   winW = window.innerWidth;
   winH = window.innerHeight;
  } else if (document.documentElement && document.documentElement.clientHeight) {// IE 6 Strict Mode
   winW = document.documentElement.clientWidth;
   winH = document.documentElement.clientHeight;
  } else if (document.body) { // other
   winW = document.body.clientWidth;
   winH = document.body.clientHeight;
  }  // for small pages with total size less then the viewport
  return {WinW:winW, WinH:winH};
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics