ExtJS4学习笔记(三)---window的创建

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 17:31   1737   0

Extjs4,创建Ext组件有了新的方式,就是Ext.create(....),而且可以使用动态加载JS的方式来加快组件的渲染,我们再也不必一次加载已经达到1MB的ext-all.js了,本文介绍如何在EXTJS4中创建一个window。

注:代码中所有Ext.Window应该是Ext.window.Window,如果按Ext.Window的话,在某些浏览器中显示不出Window窗口,切记。。。。

代码如下:

  1. <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <htmlxmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
  5. <title>窗口实例</title>
  6. <linkrel="stylesheet"type="text/css"href="../../resources/css/ext-all.css"/>
  7. <scripttype="text/javascript"src="../../bootstrap.js"></script>
  8. <scripttype="text/javascript"src="../../locale/ext-lang-zh_CN.js"></script>
  9. <scripttype="text/jscript">
  10. Ext.require('Ext.window');
  11. Ext.onReady(function(){
  12. Ext.create('Ext.Window',{
  13. width:400,
  14. height:230,
  15. //X,Y标识窗口相对于父窗口的偏移值。
  16. x:10,
  17. y:10,
  18. plain:true,
  19. //指示标题头的位置,分别为top,bottom,left,right,默认为top
  20. headerPosition:'left',
  21. title:'ExtJS4Window的创建,头在左'
  22. }).show();
  23. Ext.create('Ext.Window',{
  24. width:400,
  25. height:230,
  26. x:500,
  27. y:10,
  28. plain:true,
  29. //指示标题头的位置,分别为top,bottom,left,right,默认为top
  30. headerPosition:'right',
  31. title:'ExtJS4Window的创建,头在右'
  32. }).show();
  33. Ext.create('Ext.Window',{
  34. width:400,
  35. height:230,
  36. x:10,
  37. y:300,
  38. plain:true,
  39. //指示标题头的位置,分别为top,bottom,left,right,默认为top
  40. headerPosition:'bottom',
  41. title:'ExtJS4Window的创建,头在底'
  42. }).show();
  43. varwin=Ext.create('Ext.Window',{
  44. width:400,
  45. height:230,
  46. x:500,
  47. y:300,
  48. plain:true,
  49. //指示标题头的位置,分别为top,bottom,left,right,默认为top
  50. headerPosition:'top',
  51. title:'ExtJS4Window的创建'
  52. });
  53. win.show();
  54. });
  55. </script>
  56. </head>

  57. <body>
  58. </body>
  59. </html>

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP