ExtJs学习笔记(12)_Anchor布局
Anchor布局的效果直接看代码和效果图最为直观
Code
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
<title>WindowLayOut</title>
<linkrel="stylesheet"type="text/css"href="../resources/css/ext-all.css"/>
<scripttype="text/javascript"src="../adapter/ext/ext-base.js"></script>
<scripttype="text/javascript"src="../ext-all-debug.js"></script>
<styletype="text/css">
.x-panel-bodyp{}{
margin:10px;
font-size:12px;
}
</style>
</head>
<body>
<scripttype="text/javascript">
//AnchorLayout要点:"1.容器内的组件要么指定宽度,要么在anchor中同时指定高/宽,2.anchor值通常只能为负值(指非百分比值),正值没有意义,3.anchor必须为字符串值"
Ext.onReady(function(){
varpanel1=newExt.Panel({
title:"panel1",
height:100,
anchor:'-50',
html:"高度等于100,宽度=容器宽度-50"
});
varpanel2=newExt.Panel({
title:"panel2",
height:100,
anchor:'50%',
html:"高度等于100,宽度=容器宽度的50%"
});
varpanel3=newExt.Panel({
title:"panel3",
anchor:'-10,-250',
html:"宽度=容器宽度-10,高度=容器宽度-250"
});
varwin=newExt.Window({
title:"AnchorLayout",
height:400,
width:400,
plain:true,
layout:'anchor',
items:[panel1,panel2,panel3]
});
win.show();
});
</script>
</body>
</html>
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
<title>WindowLayOut</title>
<linkrel="stylesheet"type="text/css"href="../resources/css/ext-all.css"/>
<scripttype="text/javascript"src="../adapter/ext/ext-base.js"></script>
<scripttype="text/javascript"src="../ext-all-debug.js"></script>
<styletype="text/css">
.x-panel-bodyp{}{
margin:10px;
font-size:12px;
}
</style>
</head>
<body>
<scripttype="text/javascript">
//AnchorLayout要点:"1.容器内的组件要么指定宽度,要么在anchor中同时指定高/宽,2.anchor值通常只能为负值(指非百分比值),正值没有意义,3.anchor必须为字符串值"
Ext.onReady(function(){
varpanel1=newExt.Panel({
title:"panel1",
height:100,
anchor:'-50',
html:"高度等于100,宽度=容器宽度-50"
});
varpanel2=newExt.Panel({
title:"panel2",
height:100,
anchor:'50%',
html:"高度等于100,宽度=容器宽度的50%"
});
varpanel3=newExt.Panel({
title:"panel3",
anchor:'-10,-250',
html:"宽度=容器宽度-10,高度=容器宽度-250"
});
varwin=newExt.Window({
title:"AnchorLayout",
height:400,
width:400,
plain:true,
layout:'anchor',
items:[panel1,panel2,panel3]
});
win.show();
});
</script>
</body>
</html>
欢迎加入:http://www.itpob.cn/bbs