说明:面板是一种面向用户界面构建应用程序最佳的单元块,一种特定功能和结构化组件。
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="Ext/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
<script src="Ext/adapter/ext/ext-base.js" type="text/javascript"></script>
<script src="Ext/ext-all.js" type="text/javascript"></script>
<script type="text/javascript">
Ext.onReady(function() {
var p = new Ext.Panel({
title: "My Panel",
collapsible: true,
x: 100,
y: 100,
width: 400,
height: 300,
floating: true, //设置面板浮动
frame: true, //设置完全透明和阴影效果
//draggable:true,
draggable: {
insertProxy: false, //去掉虚边框
onDrag: function(e) {
var pel = this.proxy.getEl(); //得到当前的元素
this.x = pel.getLeft(true); //得到拖动时新的panel的x轴坐标
this.y = pel.getTop(true); //得到拖动时新的panel的y轴坐标
var s = this.panel.getEl().shadow; //得到拖动panel时的阴影对象
if (s) {
s.realign(this.x, this.y, pel.getWidth(), pel.getHeight());
//设置阴影和新的panel一致
}
},
endDrag: function(e) {
this.panel.setPosition(this.x, this.y);
}
},
html: "<p>我是内容</p>",
renderTo: "container",
buttonAlign: "center", tbar: [{ text: "工具栏1" }, { text: "工具栏2", handler: function() { alert("ok"); } }],
bbar: [{ text: "状态栏1" }, { text: "状态栏2", handler: function() { alert("状态栏2"); } }],
buttons: [{ text: "注册" }, { text: "退出", handler: function() { p.hide(); } }],
tools:[{id:"save"},{id:"help"},{id:"up"},{id:"close",handler:function(){Ext.MessageBox.alert("工具栏按钮","工具栏上的关闭按钮时间被激发了")}}] }); //alert(document.getElementById("container").outerHTML); // p.render("container"); });
</script>
</head>
<body>
<div id="container"></div>
</body>
</html>
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZkAAAE8CAIAAACdFlvEAAAHzElEQVR4nO3crW4baQCF4VxfbmNxLmDvpbTQ0GSlXRLJBpFcEMkBkcbA4AMBHwgwWOAF404m/t/Uracnz9ED4slMMgV95bpObtZmZr//bq59A2ZmF5iWmVnCtMzMEqZlZ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mQQMuABFoGJNAyIIGWAQm0DEigZUACLQMSaBmQQMuABFoGJNAyIIGWAQm0DEigZUACLQMSaBmQQMuABFoGJNAyIIGWAQm0DEigZUCCAy1b/7teva7qSy3LMpqW2XOXM4DBmT2V2XMZTUtZln0tq7WUMp6W0bSM7huA4ZqW8bSUstuy1arWWl/qfFHnizp7rrPnAjBIm1LVl7qnZe1Ts/pSSyllWZpFAzBAZVlKKfWl1rrVsvX7nHVFMzMb3tqK1VpXr6s9LdvkbLVavfaiZmY2sLWNarfTsl7R3nXNzGxg65fqQMvMzH6r/QeNETO/6UVPHQAAAABJRU5ErkJggg==" alt="" />
(带顶部,底部,脚部工具栏的panel ):
var p=new Ext.Panel({
id:"panel1",
title:"标题",
collapsible:true,
renderTo:"container",
closable:true,
width:400,
height:300,
tbar:[{text:"按钮1"},{text:"按钮2"}], //顶部工具栏
bbar:[{text:"按钮1"},{text:"按钮2"}], //底部工具栏
html:"内容",
buttons: [{ text: "按钮1" }, { text: "按钮2"}] //footer部工具栏
});
(标准Panel工具栏)
//添加下面的代码到panel配置参数中tools:
[{id:"save"},{id:"help"},{id:"up"},{id:"close",handler:function(){Ext.MessageBox.alert("工具栏按钮","工具栏上的关闭按钮时间被激发了")}}],
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZ8AAAE4CAIAAAALmWmVAAAReklEQVR4nO3dv2vb/L7A8Q5n6PAMHs7wDHe4D5zlbjHc4XR0/gTDGWroUMIdLuEOF9MhlCxBdAimQykZguhQSIaAOwTcIaAuBWUwKENAGQxfDxk0dNCQQUMGnUG2LMuSrDiSJX36Fi+Ko3wlS6n1RpLz44XDxMTEJHF6UfUGMDExMZUyUTcmJiaZE3VjYmKSOVE3JiYmmRN1Y2Jikjmt1O1+iZoqAKihWKzW1S1WtAkA1FisdKl1i6ZtovQrF8DWPP7zn3iO1cAt1S2attHY9TwfwHZUXoemm53BZdVtouw7W79yPc9XjgdgOyqvQ9Otr5t9Z9u31A3YtsVRWvWWNEj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1b237zlbTdXULTt+CwAFAzc3SFlyWrqlbJHDWjWWNAaCWbqxo2tbULR64O9u+BYBaultJW2rdYoGbqmL/mgYAFGyamraVus0DF6r8dwECQKJYrFanfwP/zG0bK8dJ2gAAAABJRU5ErkJggg==" alt="" />
panel组件的子类组件包括TabPanel,GridPanel,
FormPanel,TreePanel组件,所以非常有必要介绍Panel组件的配置参数和相关的属性、方法。
//配置参数(只列举部分常用参数)
1.autoLoad:有效的url字符串,把那个url中的body中的数据加载显示,但是可能没有样式和js控制,只是html数据
2.autoScroll:设为true则内容溢出的时候产生滚动条,默认为false
3.autoShow:设为true显示设为"x-hidden"的元素,很有必要,默认为false
4.bbar:底部条,显示在主体内,//代码:bbar:[{text:'底部工具栏bottomToolbar'}],
5.tbar:顶部条,显示在主体内,//代码:tbar:[{text:'顶部工具栏topToolbar'}],
7.buttonAlign:footer中按钮的位置,枚举值为:"left","right","center",默认为right
8.collapsible:设为true,显示右上角的收缩按钮,默认为false
9.draggable:true则可拖动,但需要你提供操作过程,默认为false
10.html:主体的内容
11.id:id值,通过id可以找到这个组件,建议一般加上这个id值
12.width:宽度
13.height:高度
13.title:标题
15.applyTo:(id)呈现在哪个html元素里面
17.renderTo:(id)呈现在哪个html元素里面
注:
2、applyTo与applyToMarkup方法对应
简单的说,
applyTo是将组件加在了指定元素之后,
而renderTo则是加在指定元素之内。