Class YAHOO.ext.LayoutDialog
Dialog which provides adjustments for working with a layout in a Dialog.
Add your neccessary layout config options to the dialogs config.
Example Usage (including a nested layout):
if(!dialog){
dialog = new YAHOO.ext.LayoutDialog("download-dlg", {
modal: true,
width:600,
height:450,
shadow:true,
minWidth:500,
minHeight:350,
autoTabs:true,
proxyDrag:true,
// layout config merges with the dialog config
center:{
tabPosition: 'top',
alwaysShowTabs: true
}
});
dialog.addKeyListener(27, dialog.hide, dialog);
dialog.setDefaultButton(dialog.addButton('Close', dialog.hide, dialog));
dialog.addButton('Build It!', this.getDownload, this);
// we can even add nested layouts
var innerLayout = new YAHOO.ext.BorderLayout('dl-inner', {
east: {
initialSize: 200,
autoScroll:true,
split:true
},
center: {
autoScroll:true
}
});
innerLayout.beginUpdate();
innerLayout.add('east', new YAHOO.ext.ContentPanel('dl-details'));
innerLayout.add('center', new YAHOO.ext.ContentPanel('selection-panel'));
innerLayout.endUpdate(true);
// when doing updates to the top level layout in a dialog, you need to
// use dialog.beginUpdate()/endUpdate() instead of layout.beginUpdate()/endUpdate()
var layout = dialog.getLayout();
dialog.beginUpdate();
layout.add('center', new YAHOO.ext.ContentPanel('standard-panel',
{title: 'Download the Source', fitToFrame:true}));
layout.add('center', new YAHOO.ext.NestedLayoutPanel(innerLayout,
{title: 'Build your own yui-ext.js'}));
layout.getRegion('center').showPanel(sp);
dialog.endUpdate();
Public Properties
Public Methods
|
LayoutDialog(String/HTMLElement/YAHOO.ext.Element el , Object config ) |
LayoutDialog |
|
|
addButton(String/Object config , Function handler , [Object scope ]) : YAHOO.ext.BasicDialog.Button |
BasicDialog |
Adds a button. |
|
addKeyListener(Number/Array/Object key , Function fn , [Object scope ]) : void |
BasicDialog |
Adds a key listener for when this dialog is displayed |
|
addListener(String eventName , Function handler , [Object scope ], [boolean override ]) : void |
Observable |
Appends an event handler to this element |
|
beginUpdate() : void |
LayoutDialog |
Begins an update of the layout and sets display to block and visibility to hidden. |
|
delayedListener(String eventName , Function handler , [Object scope ], [Number delay ]) : Function |
Observable |
Appends an event handler to this element that is delayed the specified number of milliseconds. |
|
destroy([Boolean removeEl ]) : void |
BasicDialog |
Destroys this dialog |
|
endUpdate() : void |
LayoutDialog |
Ends update of the layout and resets display to none. |
|
fireEvent(String eventName , Object... args ) : void |
Observable |
Fires the specified event with the passed parameters (minus the event name). |
|
getEl() : YAHOO.ext.BasicDialog |
BasicDialog |
Returns the element for this dialog |
|
getLayout() : YAHOO.ext.BorderLayout |
LayoutDialog |
Get the BorderLayout for this dialog |
|
getTabs() : YAHOO.ext.TabPanel |
BasicDialog |
Returns the TabPanel component (if autoTabs) |
|
hide([Function callback ]) : void |
BasicDialog |
Hides the dialog. |
|
isVisible() : Boolean |
BasicDialog |
Returns true if the dialog is visible |
|
purgeListeners() : void |
Observable |
Removes all listeners for this object |
|
removeListener(String eventName , Function handler , [Object scope ]) : void |
Observable |
Removes a listener |
|
restoreState() : void |
BasicDialog |
Restores the previous state of the dialog if YAHOO.ext.state is configured |
|
setDefaultButton(YAHOO.ext.BasicDialog.Button btn ) : void |
BasicDialog |
Sets the default button to be focused when the dialog is displayed |
|
show([String/HTMLElement/YAHOO.ext.Element animateTarget ]) : void |
BasicDialog |
Shows the dialog. |
Public Events
|
beforehide : (YAHOO.ext.BasicDialog this ) |
BasicDialog |
Fires before this dialog is hidden. |
|
beforeshow : (YAHOO.ext.BasicDialog this ) |
BasicDialog |
Fires before this dialog is shown. |
|
hide : (YAHOO.ext.BasicDialog this ) |
BasicDialog |
Fires when this dialog is hidden. |
|
keydown : (YAHOO.ext.BasicDialog this , YAHOO.ext.EventObject e ) |
BasicDialog |
Fires when a key is pressed |
|
move : (YAHOO.ext.BasicDialog this , Number x , Number y ) |
BasicDialog |
Fires when this dialog is moved by the user. |
|
resize : (YAHOO.ext.BasicDialog this , Number width , Number height ) |
BasicDialog |
Fires when this dialog is resized by the user. |
|
show : (YAHOO.ext.BasicDialog this ) |
BasicDialog |
Fires when this dialog is shown. |
Property Details
body
public YAHOO.ext.Element body
The body element
footer
public YAHOO.ext.Element footer
The footer element
header
public YAHOO.ext.Element header
The header element
Constructor Details
LayoutDialog
public function LayoutDialog(String/HTMLElement/YAHOO.ext.Element el
, Object config
)
Method Details
addButton
public function addButton(String/Object config
, Function handler
, [Object scope
])
Adds a button.
Parameters:
config
: String/ObjectA string becomes the button text, an object is expected to be a valid YAHOO.ext.DomHelper element config
handler
: FunctionThe function called when the button is clicked
scope
: Object(optional) The scope of the handler function
Returns:
YAHOO.ext.BasicDialog.Button
addKeyListener
public function addKeyListener(Number/Array/Object key
, Function fn
, [Object scope
])
Adds a key listener for when this dialog is displayed
Parameters:
key
: Number/Array/ObjectEither the numeric key code, array of key codes or an object with the following options: {key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}
fn
: FunctionThe function to call
scope
: Object(optional) The scope of the function
Returns:
addListener
public function addListener(String eventName
, Function handler
, [Object scope
], [boolean override
])
Appends an event handler to this element
Parameters:
eventName
: StringThe type of event to listen for
handler
: FunctionThe method the event invokes
scope
: Object(optional) The scope (this object) for the handler
override
: boolean(optional) If true, scope becomes the scope
Returns:
beginUpdate
public function beginUpdate()
Begins an update of the layout and sets display to block and visibility to hidden.
This method is defined by LayoutDialog.
delayedListener
public function delayedListener(String eventName
, Function handler
, [Object scope
], [Number delay
])
Appends an event handler to this element that is delayed the specified number of milliseconds.
Parameters:
eventName
: StringThe type of event to listen for
handler
: FunctionThe method the event invokes
scope
: Object(optional) The scope (this object) for the handler
delay
: Number(optional) The number of milliseconds to delay
Returns:
destroy
public function destroy([Boolean removeEl
])
endUpdate
public function endUpdate()
Ends update of the layout and resets display to none.
This method is defined by LayoutDialog.
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 the element for this dialog
getLayout
public function getLayout()
Get the BorderLayout for this dialog
This method is defined by LayoutDialog.
getTabs
public function getTabs()
Returns the TabPanel component (if autoTabs)
hide
public function hide([Function callback
])
isVisible
public function isVisible()
Returns true if the dialog is visible
purgeListeners
public function purgeListeners()
Removes all listeners for this object
removeListener
public function removeListener(String eventName
, Function handler
, [Object scope
])
restoreState
public function restoreState()
Restores the previous state of the dialog if YAHOO.ext.state is configured
setDefaultButton
public function setDefaultButton(YAHOO.ext.BasicDialog.Button btn
)
Sets the default button to be focused when the dialog is displayed
show
public function show([String/HTMLElement/YAHOO.ext.Element animateTarget
])
Event Details
beforehide
public event beforehide
Fires before this dialog is hidden.
Subscribers will be called with the following parameters:
this
: YAHOO.ext.BasicDialog
beforeshow
public event beforeshow
Fires before this dialog is shown.
Subscribers will be called with the following parameters:
this
: YAHOO.ext.BasicDialog
hide
public event hide
Fires when this dialog is hidden.
Subscribers will be called with the following parameters:
this
: YAHOO.ext.BasicDialog
keydown
public event keydown
Fires when a key is pressed
Subscribers will be called with the following parameters:
this
: YAHOO.ext.BasicDialoge
: YAHOO.ext.EventObject
move
public event move
Fires when this dialog is moved by the user.
Subscribers will be called with the following parameters:
this
: YAHOO.ext.BasicDialogx
: NumberThe new page X
y
: NumberThe new page Y
resize
public event resize
Fires when this dialog is resized by the user.
Subscribers will be called with the following parameters:
this
: YAHOO.ext.BasicDialogwidth
: NumberThe new width
height
: NumberThe new height
show
public event show
Fires when this dialog is shown.
Subscribers will be called with the following parameters:
this
: YAHOO.ext.BasicDialog