Properties Methods Events Direct Link

Class Ext.MessageBox

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
});


This class is a singleton and cannot be created directly.

Public Properties

PropertyDefined By
 CANCEL : Object
Button config that displays a single Cancel button
MessageBox
 ERROR : String
The CSS class that provides the ERROR icon image
MessageBox
 INFO : String
The CSS class that provides the INFO icon image
MessageBox
 Msg : Object
Shorthand for Ext.MessageBox
MessageBox
 OK : Object
Button config that displays a single OK button
MessageBox
 OKCANCEL : Object
Button config that displays OK and Cancel buttons
MessageBox
 QUESTION : String
The CSS class that provides the QUESTION icon image
MessageBox
 WARNING : String
The CSS class that provides the WARNING icon image
MessageBox
 YESNO : Object
Button config that displays Yes and No buttons
MessageBox
 YESNOCANCEL : Object
Button config that displays Yes, No and Cancel buttons
MessageBox
 defaultTextHeight : Number
The default height in pixels of the message box's multiline textarea if displayed (defaults to 75)
MessageBox
 maxWidth : Number
The maximum width in pixels of the message box (defaults to 600)
MessageBox
 minWidth : Number
The minimum width in pixels of the message box (defaults to 110)
MessageBox

Public Methods

MethodDefined By

Public Events

This class has no public events.