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. Property | Defined By | |
---|---|---|
monitorWindowResize : Boolean | LayoutManager | |
false to disable window resize monitoring |
Method | Defined By | |
---|---|---|
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 | |
Copies any events from the passed object onto this object if they do not already exist. The passed object must also ... | ||
addListener(String eventName , Function handler , [Object scope ], [Object options ]) : void |
Observable | |
Appends an event handler to this component | ||
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 | |
Fires the specified event with the passed parameters (minus the event name). | ||
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 | |
Checks to see if this object is currently listening for a specified event | ||
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 | |
Appends an event handler to this element (shorthand for addListener) | ||
purgeListeners() : void | Observable | |
Removes all listeners for this object | ||
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 | |
Removes a listener | ||
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 | |
Removes a listener (shorthand for removeListener) |
Event | Defined By | |
---|---|---|
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.ContentPanel
public function addEvents(Object object
)
object
: Objectvoid
public function addListener(String eventName
, Function handler
, [Object scope
], [Object options
])
eventName
: Stringhandler
: Functionscope
: Objectoptions
: Object Combining Options
Using the options argument, it is possible to combine different types of listeners:
A normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)
el.on('click', this.onClick, this, { single: true, delay: 100, stopEvent : true, forumId: 4 });
The method also allows for a single argument to be passed which is a config object containing properties which specify multiple handlers.
Attaching multiple handlers in 1 call
Code:
el.on({ 'click' : { fn: this.onClick scope: this, delay: 100 }, 'mouseover' : { fn: this.onMouseOver scope: this }, 'mouseout' : { fn: this.onMouseOut scope: this } });
Or a shorthand syntax:
Code:
el.on({ 'click' : this.onClick, 'mouseover' : this.onMouseOver, 'mouseout' : this.onMouseOut scope: this });
void
public function addRegion(String target
, Object config
)
target
: Stringconfig
: ObjectBorderLayoutRegion
public function beginUpdate()
void
public function endUpdate(Boolean noLayout
)
noLayout
: Booleanvoid
public function findPanel(String panelId
)
panelId
: StringExt.ContentPanel
public function fireEvent(String eventName
, Object... args
)
eventName
: Stringargs
: Object...Boolean
public function getEl()
Ext.Element
public function getRegion(String target
)
target
: StringExt.LayoutRegion
public function getViewSize()
Object
public function hasListener(String eventName
)
eventName
: StringBoolean
public function isUpdating()
Boolean
public function layout()
void
public function on(String eventName
, Function handler
, [Object options
])
eventName
: Stringhandler
: Functionoptions
: Objectvoid
public function purgeListeners()
void
public function remove(String target
, Number/String/Ext.ContentPanel panel
)
target
: Stringpanel
: Number/String/Ext.ContentPanelExt.ContentPanel
public function removeListener(String eventName
, Function handler
, [Object scope
])
eventName
: Stringhandler
: Functionscope
: Objectvoid
public function restoreState([Ext.state.Provider provider
])
provider
: Ext.state.Providervoid
public function showPanel(String/ContentPanel panelId
)
panelId
: String/ContentPanelExt.ContentPanel
public function un(String eventName
, Function handler
, [Object scope
])
eventName
: Stringhandler
: Functionscope
: Objectvoid
public event layout
this
: Ext.LayoutManagerpublic event regioncollapsed
region
: Ext.LayoutRegionpublic event regionexpanded
region
: Ext.LayoutRegionpublic event regionresized
region
: Ext.LayoutRegionnewSize
: Number