面板由5部分组成一个顶部工具栏(tbar)、一个底部工具栏(bbar)、面板头部(header)、面板尾部(button)和主区域(body)
<HTML>
<HEAD>
<TITLE>使用EXT输出HelloWorld</TITLE>
<!-- 导入extjs配置 … ... -->
<link rel="stylesheet" type="text/css" href="./../ext/resources/css/ext-all.css"/>
<script type="text/javascript" src="./../ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="./../ext/ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
Ext.BLANK_IMAGE_URL='./../ext/resources/images/default/s.gif';
var _panel = new Ext.Panel({
width: 500,
height: 400,
collapsible:true,//折叠
tools:[{id:'save',handler:function(){alert("save");}},{id:'print',handler:function(){window.print();}},{id:'refresh'}],
tbar:[{text: '保存'},"-",{text: '关闭'}],
bbar:[{text: '添加内容',handler:function(){
//_panel.add({id:'panel2', title: '面板二'});
//_panel.doLayout();
var p = _panel.getComponent(2);
alert(p.title);
}},{text: '删除内容',handler:function(){
_panel.remove("panel2");
}}],
title: '我的面板',
buttons:[{text:'确定'},{text: '取消'}],
buttonAlign: 'center',
//html: "<h1>这是面板的body区域</h1>",
//autoLoad: 'new.html'
items:[
new Ext.Button({text: '按钮一'}),{xtype: "button",text: '按钮二'},
{id:'panel3', title: '面板三',height: 200,bodyBody:false,border:true}
]
});
_panel.render("form");
});
</script>
</HEAD>
<body id="form">
</body>
</HTML>
?