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

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

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

代码如下:

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>窗口实例</title>
  6. <link rel="stylesheet" type="text/css" href="http://www.cnblogs.com/resources/css/ext-all.css" />
  7. <script type="text/javascript" src="http://www.cnblogs.com/bootstrap.js"></script>
  8. <script type="text/javascript" src="http://www.cnblogs.com/locale/ext-lang-zh_CN.js"></script>
  9. <script type="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: 'ExtJS4 Window的创建,头在左'
  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: 'ExtJS4 Window的创建,头在右'
  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: 'ExtJS4 Window的创建,头在底'
  42. }).show();
  43. var win = 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: 'ExtJS4 Window的创建'
  52. });
  53. win.show();
  54. });
  55. </script>
  56. </head>
  57. <body>
  58. </body>
  59. </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>窗口实例</title>
<link rel="stylesheet" type="text/css" href="http://www.cnblogs.com/resources/css/ext-all.css" />
<script type="text/javascript" src="http://www.cnblogs.com/bootstrap.js"></script>
<script type="text/javascript" src="http://www.cnblogs.com/locale/ext-lang-zh_CN.js"></script>
<script type="text/jscript">
Ext.require('Ext.window');
Ext.onReady(function(){
Ext.create('Ext.Window',{
width:400,
height:230,
//X,Y标识窗口相对于父窗口的偏移值。
x:10,
y:10,
plain: true,
//指示标题头的位置,分别为 top,bottom,left,right,默认为top
headerPosition: 'left',
title: 'ExtJS4 Window的创建,头在左'
}).show();
Ext.create('Ext.Window',{
width:400,
height:230,
x:500,
y:10,
plain: true,
//指示标题头的位置,分别为 top,bottom,left,right,默认为top
headerPosition: 'right',
title: 'ExtJS4 Window的创建,头在右'
}).show();
Ext.create('Ext.Window',{
width:400,
height:230,
x:10,
y:300,
plain: true,
//指示标题头的位置,分别为 top,bottom,left,right,默认为top
headerPosition: 'bottom',
title: 'ExtJS4 Window的创建,头在底'
}).show();
var win = Ext.create('Ext.Window',{
width:400,
height:230,
x:500,
y:300,
plain: true,
//指示标题头的位置,分别为 top,bottom,left,right,默认为top
headerPosition: 'top',
title: 'ExtJS4 Window的创建'
});
win.show();
});
</script>
</head>
<body>
</body>
</html>
原文链接: http://www.mhzg.net/a/20114/201142910380227.html

转载于:https://www.cnblogs.com/gmval/archive/2011/05/31/2064229.html

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

本版积分规则

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

下载期权论坛手机APP