| Package: | Ext |
| Class: | BorderLayout |
| Extends: | LayoutManager |
| Subclasses: | ReaderLayout |
| Defined In: | BorderLayout.js |
var layout = new Ext.BorderLayout(document.body, {
north: {
initialSize: 25,
titlebar: false
},
west: {
split:true,
initialSize: 200,
minSize: 175,
maxSize: 400,
titlebar: true,
collapsible: true
},
east: {
split:true,
initialSize: 202,
minSize: 175,
maxSize: 400,
titlebar: true,
collapsible: true
},
south: {
split:true,
initialSize: 100,
minSize: 100,
maxSize: 200,
titlebar: true,
collapsible: true
},
center: {
titlebar: true,
autoScroll:true,
resizeTabs: true,
minTabWidth: 50,
preferredTabWidth: 150
}
});
// shorthand
var CP = Ext.ContentPanel;
layout.beginUpdate();
layout.add("north", new CP("north", "North"));
layout.add("south", new CP("south", {title: "South", closable: true}));
layout.add("west", new CP("west", {title: "West"}));
layout.add("east", new CP("autoTabs", {title: "Auto Tabs", closable: true}));
layout.add("center", new CP("center1", {title: "Close Me", closable: true}));
layout.add("center", new CP("center2", {title: "Center Panel", closable: false}));
layout.getRegion("center").showPanel("center1");
layout.endUpdate();
The container the layout is rendered into can be either the body element or any other element.
If it is not the body element, the element needs to either be an absolute positioned element,
or you will need to add "position:relative" to the css of the element. | 属性 | 定义对象 | |
|---|---|---|
| monitorWindowResize : Boolean | LayoutManager | |
| false to disable window resize monitoring | ||
| 方法 | 定义对象 | |
|---|---|---|
BorderLayout(String/HTMLElement/Element container, Object config) |
BorderLayout | |
| Create a new BorderLayout | ||
add(String target, Ext.ContentPanel panel) : Ext.ContentPanel |
BorderLayout | |
| Adds a ContentPanel (or subclass) to this layout. | ||
addEvents(Object object) : void |
Observable | |
| 将对象中没有的事件从给出的对象中复制过来。 | ||
addListener(String eventName, Function handler, [Object scope], [Object options]) : void |
Observable | |
| 为该组件加入事件处理器函数 | ||
addRegion(String target, Object config) : BorderLayoutRegion |
BorderLayout | |
| Creates and adds a new region if it doesn't already exist. | ||
| beginUpdate() : void | LayoutManager | |
| Suspend the LayoutManager from doing auto-layouts while making multiple add or remove calls | ||
endUpdate(Boolean noLayout) : void |
LayoutManager | |
| Restore auto-layouts and optionally disable the manager from performing a layout | ||
findPanel(String panelId) : Ext.ContentPanel |
BorderLayout | |
| Searches all regions for a panel with the specified id | ||
fireEvent(String eventName, Object... args) : Boolean |
Observable | |
| 触发指定的事件, 并将参数传入(至少要有事件名称)。 | ||
| getEl() : Ext.Element | LayoutManager | |
| Returns the element this layout is bound to. | ||
getRegion(String target) : Ext.LayoutRegion |
LayoutManager | |
| Returns the specified region. | ||
| getViewSize() : Object | LayoutManager | |
| Returns the size of the current view, This method normalizes document.body and element embedded layouts and performs ... | ||
hasListener(String eventName) : Boolean |
Observable | |
| 检查该对象是否拥有指定事件的侦听器 | ||
| isUpdating() : Boolean | LayoutManager | |
| Returns true if this layout is currently being updated | ||
| layout() : void | BorderLayout | |
| Performs a layout update. | ||
on(String eventName, Function handler, [Object options]) : void |
Observable | |
| 为该组件加入事件处理器函数, addListener 的简写方式 | ||
| purgeListeners() : void | Observable | |
| 从对象身上移除所有的侦听器 | ||
remove(String target, Number/String/Ext.ContentPanel panel) : Ext.ContentPanel |
BorderLayout | |
| Remove a ContentPanel (or subclass) to this layout. | ||
removeListener(String eventName, Function handler, [Object scope]) : void |
Observable | |
| 移除侦听器 | ||
restoreState([Ext.state.Provider provider]) : void |
BorderLayout | |
| Restores this layouts state using Ext.state.Manager or the state provided by the passed provider. | ||
showPanel(String/ContentPanel panelId) : Ext.ContentPanel |
BorderLayout | |
| Searches all regions for a panel with the specified id and activates (shows) it. | ||
un(String eventName, Function handler, [Object scope]) : void |
Observable | |
| 移除侦听器, removeListener 的简写方式 | ||
| 事件 | 定义对象 | |
|---|---|---|
layout : (Ext.LayoutManager this) |
LayoutManager | |
| Fires when a layout is performed. | ||
regioncollapsed : (Ext.LayoutRegion region) |
LayoutManager | |
| Fires when a region is collapsed. | ||
regionexpanded : (Ext.LayoutRegion region) |
LayoutManager | |
| Fires when a region is expanded. | ||
regionresized : (Ext.LayoutRegion region, Number newSize) |
LayoutManager | |
| Fires when the user resizes a region. | ||
public Boolean monitorWindowResize
public function BorderLayout(String/HTMLElement/Element container, Object config)
container : String/HTMLElement/Elementconfig : Objectpublic function add(String target, Ext.ContentPanel panel)
target : Stringpanel : Ext.ContentPanelExt.ContentPanelpublic function addEvents(Object object)
object : Objectvoidpublic function addListener(String eventName, Function handler, [Object scope], [Object options])
eventName : Stringhandler : Functionscope : Objectoptions : Object
组合选项
使用选项参数可以组合不同类型的监听器:
下面是一个标准的、延迟执行的、一次性的监听器,将会自动停止事件并传递一个自定义的参数(forumId)
el.on('click', this.onClick, this, { single: true, delay: 100, stopEvent : true, forumId: 4 }); 这个方法也允许传递的单个参数是一个包含多个指定处理函数的设置对象。
一次调用多个处理函数
代码:
el.on({ 'click' : { fn: this.onClick scope: this, delay: 100 }, 'mouseover' : { fn: this.onMouseOver scope: this }, 'mouseout' : { fn: this.onMouseOut scope: this } }); 或者简写为:
代码:
el.on({ 'click' : this.onClick, 'mouseover' : this.onMouseOver, 'mouseout' : this.onMouseOut scope: this });
voidpublic function addRegion(String target, Object config)
target : Stringconfig : ObjectBorderLayoutRegionpublic function beginUpdate()
voidpublic function endUpdate(Boolean noLayout)
noLayout : Booleanvoidpublic function findPanel(String panelId)
panelId : StringExt.ContentPanelpublic function fireEvent(String eventName, Object... args)
eventName : Stringargs : Object...Booleanpublic function getEl()
Ext.Elementpublic function getRegion(String target)
target : StringExt.LayoutRegionpublic function getViewSize()
Objectpublic function hasListener(String eventName)
eventName : StringBooleanpublic function isUpdating()
Booleanpublic function layout()
voidpublic function on(String eventName, Function handler, [Object options])
eventName : Stringhandler : Functionoptions : Objectvoidpublic function purgeListeners()
voidpublic function remove(String target, Number/String/Ext.ContentPanel panel)
target : Stringpanel : Number/String/Ext.ContentPanelExt.ContentPanelpublic function removeListener(String eventName, Function handler, [Object scope])
eventName : Stringhandler : Functionscope : Objectvoidpublic function restoreState([Ext.state.Provider provider])
provider : Ext.state.Providervoidpublic function showPanel(String/ContentPanel panelId)
panelId : String/ContentPanelExt.ContentPanelpublic function un(String eventName, Function handler, [Object scope])
eventName : Stringhandler : Functionscope : Objectvoidpublic event layout
this : Ext.LayoutManagerpublic event regioncollapsed
region : Ext.LayoutRegionpublic event regionexpanded
region : Ext.LayoutRegionpublic event regionresized
region : Ext.LayoutRegionnewSize : Number