First:
Adaptive width of jqGrid varies with window size
Copy codeThe Code is as follows:
$ (Function (){
$ (Window). resize (function (){
$ ("# ListId"). setGridWidth ($ (window). width ());
});
});
Second:
Copy codeThe Code is as follows:
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 bytes t IE
WinW = window. innerWidth;
WinH = window. innerHeight;
} Else if (document.doc umentElement & document.doc umentElement. clientHeight) {// IE 6 Strict Mode
WinW = document.doc umentElement. clientWidth;
WinH = document.doc umentElement. 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 };
}