Ext.layout.container.Border對應面板布局layout配置項的名稱為Border,該布局包含多個子面板,是一個面向應用的UI風格的布局,它將整個容器分為5個部分,分別是:east(東)、south(南)、west(西)、north(北)和center(中)。加入到容器中的子面板需要指定region配置項來告知容器要加入到那個部分。
代碼:
<!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 runat="server"> <title>Ext.layout.container.Border示例</title> <link href="ext-4.0.7-gpl/resources/css/ext-all.css" rel="stylesheet" type="text/css" /> <script src="ext-4.0.7-gpl/bootstrap.js" type="text/javascript"></script> <script type="text/javascript"> Ext.onReady(function () { Ext.create("Ext.panel.Panel", { title: "Ext.layout.container.Border示例", frame: true, width: 500, height: 300, renderTo: Ext.getBody(), bodyPadding: 5, layout: "border", defaults: { collapsible: true }, items: [{ title: "north panel", html: "上", region: "north", height: 50 }, { title: "south panel", html: "下", region: "south", height: 50 }, { title: "west panel", html: "左", region: "west", width:100 }, { title: "east panel", html: "右", region: "east", width: 100 }, { title: "center panel", html: "中", region: "center" }] }); }); </script> </head> <body> </body> </html>
效果圖: