今天是這個Layout布局架構的基本使用:
layout就是一個布局面板:
也就是布局的容器,有五個布局地區:北部,南部,東部,西部和中心。其中中心地區面板是必需的,但中心地區面板邊緣地區面板是可選的。通過拖動它的邊框,面板,可以調整每一個邊緣地區。可以嵌套的布局,以便使用者可以建立複雜的布局。
如果想要各個地區中的架構隨架構的大小改變,請嵌套到layout架構中;
<script type="text/javascript">
//split屬性:如果設定為true將顯示一個分隔條,使用者可以拖動分隔條來改變布局面板的尺寸。
//href屬性:在指定地區內載入頁面的body中的部分,其他不載入
//在panel架構中我們可以看到這樣一個正則選擇(可根據自己需求變更):
// extractor: function (data) {
// var pattern = /<body[^>]*>((.|[\n\r])*)<\/body>/im;
// var matches = pattern.exec(data);
// if (matches) {
// return matches[1]; // only extract body content
// } else {
// return data;
// }
// }
//panel屬性:返回特定的布局面板,'region'參數的可取值為:'north','south','east','west','center'。
function getPanel() {
var southPanel = $("#layoutbody").layout('panel', 'south');
//獲得panel的屬性
var attributes = southPanel.panel('options');
console.info(attributes); //可以看到其中的各個屬性,瀏覽器調試,這裡說明下:使用這種架構和使用js自己書寫前台代碼,瀏覽器調試是必不可少的:Firefox或者Google
}
</script>
</head>
<body id="layoutbody" class="easyui-layout">
<div data-options="region:'north',title:'North Title',split:true" style="height: 100px;">
</div>
<div data-options="region:'south',title:'South Title',split:true" style="height: 100px;">
</div>
<div data-options="region:'east',iconCls:'icon-reload',title:'East',split:true" style="width: 100px;">
</div>
<div data-options="region:'west',title:'West',split:true" style="width: 100px;">
<input type="button" value="擷取panel" onclick="getPanel();" />
</div>
<div data-options="region:'center',title:'center title'" href="Index.htm" style="padding: 5px;
background: #eee;">
<input type="button" value="擷取panel" onclick="getPanel();" /><!--如果這裡指定了href屬性,那麼我們自己在這個部分寫的代碼將不會被現實-->
</div>
</body>
</html>