日期:2014-05-17  浏览次数:20669 次

使用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>使用html配置项自定义面板内容</title>
<link rel="stylesheet" href="ext-4.2.1/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-4.2.1/bootstrap.js"></script> 
<script type="text/javascript" src="ext-4.2.1/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
        //创建字符串数组
var htmlArray=[
'<table border="1">',
'<tr><th colspan="2">本地资源--员工列表</th></tr>',
'<tr><th>序号</th><th>姓名</th></tr>',
'<tr><td>1</td><td>张三</td></tr>',
'<tr><td>2</td><td>李四</td></tr>',
'<tr><td>3</td><td>李四</td></tr>',
'<tr><td>4</td><td>李四</td></tr>',
'</table>'
];
Ext.create('Ext.panel.Panel',{
title:'使用html配置项自定义面板内容',
height:150,
width:250,
frame:true, //渲染面板
collapsible:true, //允许展开和收缩
autoScroll:true, //自动显示滚动条
renderTo:Ext.getBody(),
bodyPadding:5,
html:htmlArray.join(''),
bodyStyle:'background-color:#FFFFFF' //设置面板的背景色
});
});
</script>
</head>

<body>

</body>
</html>
----------------------------------
向面板中添加一个日期控件:
<script type="text/javascript">
Ext.onReady(function(){
Ext.create('Ext.panel.Panel',{
title:'日历',
height:200,
width:300,
frame:true, //渲染面板
collapsible:true, //允许展开和收缩
autoScroll:true, //自动显示滚动条
renderTo:Ext.getBody(),
bodyPadding:5,
items:[{
xtype:'datepicker',
minDate:new Date()

}]
});
});
</script>