Package: | Ext |
Defined In: | MessageBox.js |
Class: | MessageBox |
Extends: | Object |
Utility class for generating different styles of message boxes. The alias Ext.Msg can also be used.
Note that the MessageBox is asynchronous. Unlike a regular JavaScript alert
(which will halt
browser execution), showing a MessageBox will not cause the code to stop. For this reason, if you have code
that should only run after some user feedback from the MessageBox, you must use a callback function
(see the function
parameter for show for more details).
Example usage:
// Basic alert:
Ext.Msg.alert('Status', 'Changes saved successfully.');
// Prompt for user data and process the result using a callback:
Ext.Msg.prompt('Name', 'Please enter your name:', function(btn, text){
if (btn == 'ok'){
// process text value and close...
}
});
// Show a dialog using config options:
Ext.Msg.show({
title:'Save Changes?',
msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',
buttons: Ext.Msg.YESNOCANCEL,
fn: processResult,
animEl: 'elId',
icon: Ext.MessageBox.QUESTION
});
Method | Defined By | |
---|---|---|
alert( String title , String msg , [Function fn ], [Object scope ] ) : Ext.MessageBox Displays a standard read-only message box with an OK button (comparable to the basic JavaScript alert prompt).
If a c...
Displays a standard read-only message box with an OK button (comparable to the basic JavaScript alert prompt).
If a callback function is passed it will be called after the user clicks the button, and the
id of the button that was clicked will be passed as the only parameter to the callback
(could also be the top-right close button).
Parameters:
|
MessageBox | |
confirm( String title , String msg , [Function fn ], [Object scope ] ) : Ext.MessageBox Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm).
If a callback funct...
Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm).
If a callback function is passed it will be called after the user clicks either button,
and the id of the button that was clicked will be passed as the only parameter to the callback
(could also be the top-right close button).
Parameters:
|
MessageBox | |
getDialog() : Ext.Window Returns a reference to the underlying Ext.Window element
Returns a reference to the underlying Ext.Window element
Parameters:
|
MessageBox | |
hide() : Ext.MessageBox Hides the message box if it is displayed
Hides the message box if it is displayed
Parameters:
|
MessageBox | |
isVisible() : Boolean Returns true if the message box is currently displayed
Returns true if the message box is currently displayed
Parameters:
|
MessageBox | |
progress( String title , String msg , [String progressText ] ) : Ext.MessageBox Displays a message box with a progress bar. This message box has no buttons and is not closeable by
the user. You a...
Displays a message box with a progress bar. This message box has no buttons and is not closeable by
the user. You are responsible for updating the progress bar as needed via Ext.MessageBox.updateProgress
and closing the message box when the process is complete.
Parameters:
|
MessageBox | |
prompt( String title , String msg , [Function fn ], [Object scope ], [Boolean/Number multiline ], [String value ] ) : Ext.MessageBox Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's p...
Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt).
The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user
clicks either button, and the id of the button that was clicked (could also be the top-right
close button) and the text that was entered will be passed as the two parameters to the callback.
Parameters:
|
MessageBox | |
setIcon( String icon ) : Ext.MessageBox Adds the specified icon to the dialog. By default, the class 'ext-mb-icon' is applied for default
styling, and the c...
Adds the specified icon to the dialog. By default, the class 'ext-mb-icon' is applied for default
styling, and the class passed in is expected to supply the background image url. Pass in empty string ('')
to clear any existing icon. The following built-in icon classes are supported, but you can also pass
in a custom class name:
Ext.MessageBox.INFO Ext.MessageBox.WARNING Ext.MessageBox.QUESTION Ext.MessageBox.ERROR
Parameters:
|
MessageBox | |
show( Object config ) : Ext.MessageBox Displays a new message box, or reinitializes an existing message box, based on the config options
passed in. All disp...
Displays a new message box, or reinitializes an existing message box, based on the config options
passed in. All display functions (e.g. prompt, alert, etc.) on MessageBox call this function internally,
although those calls are basic shortcuts and do not support all of the config options allowed here.
Parameters:
|
MessageBox | |
updateProgress( Number value , String progressText , String msg ) : Ext.MessageBox Updates a progress-style message box's text and progress bar. Only relevant on message boxes
initiated via Ext.Messa...
Updates a progress-style message box's text and progress bar. Only relevant on message boxes
initiated via Ext.MessageBox.progress or by calling Ext.MessageBox.show with progress: true.
Parameters:
|
MessageBox | |
updateText( [String text ] ) : Ext.MessageBox Updates the message box body text
Updates the message box body text
Parameters:
|
MessageBox | |
wait( String msg , [String title ], [Object config ] ) : Ext.MessageBox Displays a message box with an infinitely auto-updating progress bar. This can be used to block user
interaction whi...
Displays a message box with an infinitely auto-updating progress bar. This can be used to block user
interaction while waiting for a long-running process to complete that does not have defined intervals.
You are responsible for closing the message box when the process is complete.
Parameters:
|
MessageBox |