Struts2 中jQuery Grid的自适应方案2

来源:互联网 发布:php bind 编辑:程序博客网 时间:2024/05/21 22:39

    在前一篇博客中,转载了一篇别人写的如果做jQuery Grid的自适应浏览器调整的文章。

    不过那个方法趋于复杂化。

     下面使用另外的方法。

     二者的区别是,第一种方法完全是在浏览器端优化Grid,不需要Server的帮忙了。

     这第二种方案就是在window.onResize后调用刷新屏幕的办法。

     我使用了第二种办法,客户体验不如第一种,不过速度也很快。

      

<body onResize='window.location.reload();'>
<sjg:grid id="gridtable" dataType="json" href="%{remoteurl}"pager="true" pagerInput="false" gridModel="gridModel"rowList="10,15,20" rowNum="10" rownumbers="true" navigator="true"autowidth="true" navigatorView="true">
请注意

grid定义中明确使用 autowidth="true"

关于window的函数,如下:

Window Object 19. 2. 1. Window   19. 2. 2. window.alert()   19. 2. 3. window.back()   19. 2. 4. window.captureEvents()   19. 2. 5. window.clearInterval()   19. 2. 6. window.clearTimeout()   19. 2. 7. window.defaultStatus   19. 2. 8. window.disableExternalCapture()   19. 2. 9. window.document   19. 2. 10. window.enableExternalCapture()   19. 2. 11. window.find()   19. 2. 12. window.focus()   19. 2. 13. window.forward()   19. 2. 14. window.frames   19. 2. 15. window.frames.length   19. 2. 16. window.home()   19. 2. 17. window.innerHeight   19. 2. 18. window.innerWidth   19. 2. 19. window.length   19. 2. 20. window.location   19. 2. 21. window.locationbar   19. 2. 22. window.menubar   19. 2. 23. window.moveBy()   19. 2. 24. window.moveTo()   19. 2. 25. window.name   19. 2. 26. window.onBlur   19. 2. 27. window.onDragDrop   19. 2. 28. window.onError   19. 2. 29. window.onFocus   19. 2. 30. window.onLoad   19. 2. 31. window.onMove   19. 2. 32. window.onResize   19. 2. 33. window.onUnLoad   19. 2. 34. window.open()   19. 2. 35. window.opener   19. 2. 36. window.outerHeight   19. 2. 37. window.outerWidth   19. 2. 38. window.pageXOffset   19. 2. 39. window.pageYOffset   19. 2. 40. window.parent   19. 2. 41. window.personalbar   19. 2. 42. window.print()   19. 2. 43. window.prompt()   19. 2. 44. window.releaseEvents()   19. 2. 45. window.resizeBy()   19. 2. 46. window.resizeTo()   19. 2. 47. window.routeEvent()   19. 2. 48. window.scroll()   19. 2. 49. window.scrollbars   19. 2. 50. window.scrollBy()   19. 2. 51. window.scrollTo()   19. 2. 52. window.self   19. 2. 53. window.setInterval()   19. 2. 54. window.setTimeout()   19. 2. 55. window.status   19. 2. 56. window.statusbar   19. 2. 57. window.stop()   19. 2. 58. window.toolbar   19. 2. 59. window.top


关于JS的刷新,重载:

 javascript refresh page

Javascript刷新页面的几种方法:
1    history.go(0)
2    location.reload()
3    location=location
4    location.assign(location)
5    document.execCommand('Refresh')
6    window.navigate(location)
7    location.replace(location)
8    document.URL=location.href

自动刷新页面的方法:
1.页面自动刷新:把如下代码加入<head>区域中
<meta http-equiv="refresh" content="20">
其中20指每隔20秒刷新一次页面.

2.页面自动跳转:把如下代码加入<head>区域中
<meta http-equiv="refresh" content="20;url=http://www.wyxg.com">
其中20指隔20秒后跳转到http:
//www.wyxg.com页面

3.页面自动刷新js版

<script language="JavaScript">function myrefresh(){       window.location.reload();}setTimeout('myrefresh()',1000); //指定1秒刷新一次</script>




JS刷新框架的脚本语句

//如何刷新包含该框架的页面用  <script language=JavaScript>   parent.location.reload();</script>   //子窗口刷新父窗口<script language=JavaScript>    self.opener.location.reload();</script>( 或 <a href="javascript:opener.location.reload()">刷新</a>   )//如何刷新另一个框架的页面用  <script language=JavaScript>   parent.otherFrameID.location.reload();</script>



如果想关闭窗口时刷新或者想开窗时刷新的话,在
<body>中调用以下语句即可。
<body onload="opener.location.reload()"> 开窗时刷新<body onUnload="opener.location.reload()"> 关闭时刷新<script language="javascript">window.opener.document.location.reload()</script>







原创粉丝点击