A basic ContentPanel element.
This class has no public properties.
|
ContentPanel( String/HTMLElement/Ext.Element el , String/Object config , [String content ] ) |
ContentPanel |
Create a new ContentPanel. |
|
addEvents( Object object ) : void |
Observable |
Used to define events on this Observable |
|
addListener( String eventName , Function handler , [Object scope ], [Object options ] ) : void |
Observable |
Appends an event handler to this component |
|
destroy() : void |
ContentPanel |
Destroys this panel |
|
fireEvent( String eventName , Object... args ) : Boolean |
Observable |
Fires the specified event with the passed parameters (minus the event name). |
|
getEl() : Ext.Element |
ContentPanel |
Returns this panel's element |
|
getId() : String |
ContentPanel |
Returns this panel's id |
|
getTitle() : String |
ContentPanel |
Returns this panel's title |
|
getToolbar() : Ext.Toolbar |
ContentPanel |
Returns the toolbar for this Panel if one was configured. |
|
getUpdateManager() : Ext.UpdateManager |
ContentPanel |
Get the Ext.UpdateManager for this panel. Enables you to perform Ajax updates. |
|
hasListener( String eventName ) : Boolean |
Observable |
Checks to see if this object has any listeners for a specified event |
|
isClosable() : Boolean |
ContentPanel |
Returns true is this panel was configured to be closable |
|
load( Object/String/Function url , [String/Object params ], [Function callback ], [Boolean discardUrl ] ) : Ext.ContentPanel |
ContentPanel |
Loads this content panel immediately with content from XHR. Note: to delay loading until the panel is activated, use ... |
|
on( String eventName , Function handler , [Object scope ], [Object options ] ) : void |
Observable |
Appends an event handler to this element (shorthand for addListener) |
|
purgeListeners() : void |
Observable |
Removes all listeners for this object |
|
refresh() : void |
ContentPanel |
Force a content refresh from the URL specified in the setUrl method.
Will fail silently if the setUrl method has not ... |
|
removeListener( String eventName , Function handler , [Object scope ] ) : void |
Observable |
Removes a listener |
|
setContent( String content , [Boolean loadScripts ] ) : void |
ContentPanel |
Updates this panel's element |
|
setTitle( String title ) : void |
ContentPanel |
Set this panel's title |
|
setUrl( String/Function url , [String/Object params ], [Boolean loadOnce ] ) : Ext.UpdateManager |
ContentPanel |
Set a URL to be used to load the content for this panel. When this panel is activated, the content will be loaded fro... |
|
un( String eventName , Function handler , [Object scope ] ) : void |
Observable |
Removes a listener (shorthand for removeListener) |
|
adjustments : Array |
ContentPanel |
Values to add to the width/height when doing a fitToFrame (default is [0, 0]) |
|
autoCreate : Boolean/Object |
ContentPanel |
True to auto generate the DOM element for this panel, or a Ext.DomHelper config of the element to create |
|
autoScroll : Boolean |
ContentPanel |
True to scroll overflow in this panel (use with fitToFrame) |
|
background : Boolean |
ContentPanel |
True if the panel should not be activated when it is added (defaults to false) |
|
closable : Boolean |
ContentPanel |
True if the panel can be closed/removed |
|
fitContainer : Boolean |
ContentPanel |
When using fitToFrame and resizeEl, you can also fit the parent container (defaults to false) |
|
fitToFrame : Boolean |
ContentPanel |
True for this panel to adjust its size to fit when the region resizes (defaults to false) |
|
loadOnce : Boolean |
ContentPanel |
When used with url, calls setUrl with this value |
|
params : String/Object |
ContentPanel |
When used with url, calls setUrl with this value |
|
resizeEl : String/HTMLElement/Element |
ContentPanel |
An element to resize if fitToFrame is true (instead of this panel's element) |
|
title : String |
ContentPanel |
The title for this panel |
|
toolbar : Toolbar |
ContentPanel |
A toolbar for this panel |
|
url : String |
ContentPanel |
Calls setUrl with this value |
addEvents
public function addEvents( Object object
)
Used to define events on this Observable
addListener
public function addListener( String eventName
, Function handler
, [Object scope
], [Object options
] )
Appends an event handler to this component
Parameters:
eventName
: StringThe type of event to listen for
handler
: FunctionThe method the event invokes
scope
: Object(optional) The scope in which to execute the handler
function. The handler function's "this" context.
options
: Object(optional) An object containing handler configuration
properties. This may contain any of the following properties:
- scope {Object} The scope in which to execute the handler function. The handler function's "this" context.
- delay {Number} The number of milliseconds to delay the invocation of the handler after te event fires.
- single {Boolean} True to add a handler to handle just the next firing of the event, and then remove itself.
- buffer {Number} Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed
by the specified number of milliseconds. If the event fires again within that time, the original
handler is not invoked, but the new handler is scheduled in its place.
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,
forumId: 4
});
Attaching multiple handlers in 1 call
The method also allows for a single argument to be passed which is a config object containing properties
which specify multiple handlers.
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 which passes the same scope object to all handlers:
el.on({
'click': this.onClick,
'mouseover': this.onMouseOver,
'mouseout': this.onMouseOut,
scope: this
});
Returns:
destroy
public function destroy()
This method is defined by ContentPanel.
fireEvent
public function fireEvent( String eventName
, Object... args
)
Fires the specified event with the passed parameters (minus the event name).
getEl
public function getEl()
Returns this panel's element
This method is defined by ContentPanel.
getId
public function getId()
This method is defined by ContentPanel.
getTitle
public function getTitle()
Returns this panel's title
This method is defined by ContentPanel.
getToolbar
public function getToolbar()
Returns the toolbar for this Panel if one was configured.
This method is defined by ContentPanel.
getUpdateManager
public function getUpdateManager()
Get the
Ext.UpdateManager for this panel. Enables you to perform Ajax updates.
Parameters:
Returns:
Ext.UpdateManager
The UpdateManager
This method is defined by ContentPanel.
hasListener
public function hasListener( String eventName
)
Checks to see if this object has any listeners for a specified event
isClosable
public function isClosable()
Returns true is this panel was configured to be closable
This method is defined by ContentPanel.
load
public function load( Object/String/Function url
, [String/Object params
], [Function callback
], [Boolean discardUrl
] )
Loads this content panel immediately with content from XHR. Note: to delay loading until the panel is activated, use
setUrl.
Parameters:
url
: Object/String/FunctionThe url for this request or a function to call to get the url or a config object containing any of the following options:
panel.load({
url: "your-url.php",
params: {param1: "foo", param2: "bar"}, // or a URL encoded string
callback: yourFunction,
scope: yourObject, //(optional scope)
discardUrl: false,
nocache: false,
text: "Loading...",
timeout: 30,
scripts: false
});
The only required property is
url. The optional properties
nocache,
text and
scripts
are shorthand for
disableCaching,
indicatorText and
loadScripts and are used to set their associated property on this panel UpdateManager instance.
params
: String/Object(optional) The parameters to pass as either a URL encoded string "param1=1¶m2=2" or an object {param1: 1, param2: 2}
callback
: Function(optional) Callback when transaction is complete -- called with signature (oElement, bSuccess, oResponse)
discardUrl
: Boolean(optional) By default when you execute an update the defaultUrl is changed to the last used URL. If true, it will not store the URL.
Returns:
This method is defined by ContentPanel.
on
public function on( String eventName
, Function handler
, [Object scope
], [Object options
] )
Appends an event handler to this element (shorthand for addListener)
Parameters:
eventName
: StringThe type of event to listen for
handler
: FunctionThe method the event invokes
scope
: Object(optional) The scope in which to execute the handler
function. The handler function's "this" context.
options
: Object(optional)
Returns:
purgeListeners
public function purgeListeners()
Removes all listeners for this object
refresh
public function refresh()
Force a content refresh from the URL specified in the
setUrl method.
Will fail silently if the
setUrl method has not been called.
This does not activate the panel, just updates its content.
This method is defined by ContentPanel.
removeListener
public function removeListener( String eventName
, Function handler
, [Object scope
] )
setContent
public function setContent( String content
, [Boolean loadScripts
] )
Updates this panel's element
This method is defined by ContentPanel.
setTitle
public function setTitle( String title
)
This method is defined by ContentPanel.
setUrl
public function setUrl( String/Function url
, [String/Object params
], [Boolean loadOnce
] )
Set a URL to be used to load the content for this panel. When this panel is activated, the content will be loaded from that URL.
Parameters:
url
: String/FunctionThe URL to load the content from or a function to call to get the URL
params
: String/Object(optional) The string params for the update call or an object of the params. See
Ext.UpdateManager.update for more details. (Defaults to null)
loadOnce
: Boolean(optional) Whether to only load the content once. If this is false it makes the Ajax call every time this panel is activated. (Defaults to false)
Returns:
Ext.UpdateManager
The UpdateManager
This method is defined by ContentPanel.
un
public function un( String eventName
, Function handler
, [Object scope
] )
Removes a listener (shorthand for removeListener)
adjustments
adjustments : Array
Values to
add to the width/height when doing a
fitToFrame (default is [0, 0])
This config option is defined by ContentPanel.
autoCreate
autoCreate : Boolean/Object
True to auto generate the DOM element for this panel, or a
Ext.DomHelper config of the element to create
This config option is defined by ContentPanel.
autoScroll
autoScroll : Boolean
True to scroll overflow in this panel (use with
fitToFrame)
This config option is defined by ContentPanel.
background
background : Boolean
True if the panel should not be activated when it is added (defaults to false)
This config option is defined by ContentPanel.
closable
closable : Boolean
True if the panel can be closed/removed
This config option is defined by ContentPanel.
fitContainer
fitContainer : Boolean
When using
fitToFrame and
resizeEl, you can also fit the parent container (defaults to false)
This config option is defined by ContentPanel.
fitToFrame
fitToFrame : Boolean
True for this panel to adjust its size to fit when the region resizes (defaults to false)
This config option is defined by ContentPanel.
loadOnce
loadOnce : Boolean
When used with
url, calls
setUrl with this value
This config option is defined by ContentPanel.
params
params : String/Object
When used with
url, calls
setUrl with this value
This config option is defined by ContentPanel.
resizeEl
resizeEl : String/HTMLElement/Element
An element to resize if
fitToFrame is true (instead of this panel's element)
This config option is defined by ContentPanel.
title
title : String
The title for this panel
This config option is defined by ContentPanel.
toolbar
toolbar : Toolbar
A toolbar for this panel
This config option is defined by ContentPanel.
url
url : String
This config option is defined by ContentPanel.