Jump to main content Jump to doc navigation

MODx.msg

Extends: Ext.Component Key Features: AJAX connector features.

MODx.msg provides Ext.MessageBox functionality with an AJAX callback (for confirmation dialogs). Provide a URL and optional parameters, and a connector request is sent after the user confirms. Default minimum width: 200px.

Methods

alert

MODx.msg.alert(title,text,fn,scope)

Displays an alert dialog box:

MODx.msg.alert('Warning!','You are out of space! We should clear the cache.',function() {
  MODx.clearCache();
},MODx);

confirm

MODx.msg.confirm(config)

Prompts the user for a Yes/No response. On Yes, an AJAX request goes to the connector in url. Config properties:

Name Description
title The title of the confirmation box.
text The text in the confirmation box.
minWidth The confirmation popup will automatically choose a size, but to make sure it’s at least a certain width provide an integer value representing the width. (Added in 3.0.0-rc2)
url The URL to send the AJAX request to.
params The REQUEST params to send with the AJAX request.
listeners Any listeners to look for on the request.
MODx.msg.confirm({
   title: 'Are you sure?',
   text: 'Do you want to delete the world? This is irreversible.',
   url: 'http://rest.endofdays.com/armageddon/',
   params: {
      deleteWorld: true
   },
   listeners: {
        'success':{fn: function(r) {
             MODx.clearCache(); /* clear cache after world destruction, so we dont have latent data */
        },scope:true}
   }
});

MODx.msg.confirm Custom Events

Name Description
success Fires on a successful response from the AJAX submission.
failure Fires on a failed response from the AJAX submission.
cancel Fires when the user cancels the confirmation dialog.

status

MODx.msg.status(opt)

Shows a temporary status message in the top-right of the screen that fades away:

Name Description Default
title Optional. The title of the message.
message The text of the status message.
dontHide If true, will not automatically hide the status message. Will stay until it is clicked. false
delay The number of seconds to show the message. 1.5

To confirm in a CMP that an object was saved, add this to your FormPanel definition:

        listeners: {
            'success': function (res) {
                MODx.msg.status({
                    title: _('save_successful'),
                    message: res.result['message'],
                    delay: 3
                });
            }
        }

The ‘success’ listener is part of modExt and comes with MODx.FormPanel.

getWindow

Returns the underlying Ext.Window instance of the last (or given) message window:

var win = MODx.msg.getWindow();

See Also

  1. MODExt MODx Object
  2. MODExt Tutorials
    1. Ext JS Tutorial - Message Boxes
    2. Ext JS Tutorial - Ajax Include
    3. Ext JS Tutorial - Animation
    4. Ext JS Tutorial - Manipulating Nodes
    5. Ext JS Tutorial - Panels
    6. Ext JS Tutoral - Advanced Grid
    7. Ext JS Tutorial - Inside a CMP
  3. MODx.combo.ComboBox
  4. MODx.Console
  5. MODx.FormPanel
  6. MODx.grid.Grid
  7. MODx.grid.LocalGrid
  8. MODx.msg
  9. MODx.tree.Tree
  10. MODx.Window

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • CrewMark
  • Fabian Christen
  • Sepia River Studios
  • Dannevang Digital
  • A. Moreno
  • Alex
  • Chris Fickling
  • Stéphane Jäggi
  • YJ
  • Murray Wood
  • JT Skaggs
  • Anton Tarasov
  • deJaya
  • Lefthandmedia
  • eydolan
  • Following Sea
  • Guido Gallenkamp
  • Raffy
  • Snow Creative
  • Nick Clark
  • Guest
  • Helen
  • krisznet
  • Yanni
  • Richard

Budget

$185 per month—let's make that $500!

Learn more