v7.3.0
SupportExamplesFree Trial

MessageDialog
Widget
Singleton

A singleton class which shows common dialogs, similar to the native browser APIs (though these methods do not block the UI thread):

  • confirm shows a confirmation dialog with Ok / Cancel buttons
  • alert shows a dialog with a message
  • prompt shows a dialog with a text input field

targetElement.classList.add('widgetRow'); new Button({ appendTo : targetElement, text : 'confirm()', onClick : async() => { const result = await MessageDialog.confirm({ title : 'The big question', message : 'Do one legged ducks swim in circles?', okButton : 'Yes', cancelButton : 'No', rootElement : targetElement // Not needed outside of docs }); Toast.show(`You answered ${result === MessageDialog.okButton ? 'Yes' : 'No'}`); } }); new Button({ appendTo : targetElement, text : 'prompt()', onClick : async() => { const result = await MessageDialog.prompt({ title : 'Information required!', message : 'Enter your name', rootElement : targetElement // Not needed outside of docs }); if (result.button === MessageDialog.okButton) { Toast.show(`You wrote ${result.text}`); } } }); new Button({ appendTo : targetElement, text : 'alert()', onClick : () => { MessageDialog.alert({ title : 'Upgrade required!', message : 'Internet Explorer is not supported!', rootElement : targetElement // Not needed outside of docs }); } });

Note: Class is a singleton and all members listed below can be accessed as static ones.

No results

Properties

Properties are getters/setters or publicly accessible variables on this class
  • isDelayable : Booleantrue
    READONLY
    static
    ADVANCED
    Delayable
    Identifies an object as an instance of Delayable class, or subclass thereof.
  • isEvents : Booleantrue
    READONLY
    static
    ADVANCED
    Events
    Identifies an object as an instance of Events class, or subclass thereof.
  • isKeyMap : Booleantrue
    READONLY
    static
    ADVANCED
    KeyMap
    Identifies an object as an instance of KeyMap class, or subclass thereof.
  • isLocalizable : Booleantrue
    READONLY
    static
    ADVANCED
    Localizable
    Identifies an object as an instance of Localizable class, or subclass thereof.
  • isRTL : Booleantrue
    READONLY
    static
    ADVANCED
    RTL
    Identifies an object as an instance of RTL class, or subclass thereof.
  • isResizable : Booleantrue
    READONLY
    static
    ADVANCED
    Resizable
    Identifies an object as an instance of Resizable class, or subclass thereof.
  • isState : Booleantrue
    READONLY
    static
    ADVANCED
    State
    Identifies an object as an instance of State class, or subclass thereof.
  • isToolable : Booleantrue
    READONLY
    static
    ADVANCED
    Toolable
    Identifies an object as an instance of Toolable class, or subclass thereof.
  • properties : Object
    internal
    static
    Container

    A class property getter for the default values of internal properties for this class.

  • all : Widget[]
    internal
    READONLY
    static
    Container

    Returns an array containing all existing Widgets. The returned array is generated by this call and is not an internal structure.

  • focusVisible : Boolean
    internal
    READONLY
    static
    Container

    This property yields true if the currently focused element has been reached through other means than mouse click. If the activeElement matches :focus-visible.

  • recomposeAsync : Boolean
    internal
    static
    Container

    Get/set the recomposeAsync config for all widgets. Setting this value will set the config for all existing widgets and will be the default value for newly created widgets. Set this value to null to disable the default setting for new widgets while leaving existing widgets unaffected.

  • tooltip : Tooltip
    READONLY
    static
    Container

    The shared Tooltip instance which handles tooltips which are not configured with newInstance : true.

  • cancelButton : Number
    READONLY

    The enum value for the Cancel button

  • okButton : Number
    READONLY

    The enum value for the OK button

  • emptyArray : Array
    internal
    READONLY
    Container

    An empty array that can be used as a default value.

  • emptyObject : Object
    internal
    READONLY
    Container

    An empty object that can be used as a default value.

  • isContainer : Booleantrue
    READONLY
    ADVANCED
    Container
    Identifies an object as an instance of Container class, or subclass thereof.
  • isPanel : Booleantrue
    READONLY
    ADVANCED
    Panel
    Identifies an object as an instance of Panel class, or subclass thereof.
  • isPopup : Booleantrue
    READONLY
    ADVANCED
    Popup
    Identifies an object as an instance of Popup class, or subclass thereof.
  • isWidget : Booleantrue
    READONLY
    ADVANCED
    Container
    Identifies an object as an instance of Widget class, or subclass thereof.
  • Returns the first widget in this Container.

  • Number of columns to use in a grid layout. Applied as grid-template-columns: repeat(n, auto). Also applies the b-columns CSS class to the container.

  • initialItems : Boolean
    internal
    READONLY
    Container

    This property is true until the container's initial items config has been processed. This property is set to false by the updateItems method.

  • Returns true if currently setting values. Allow fields to change highlighting to distinguishing between initially setting values and later on changing values.

  • Returns true if all contained fields are valid, otherwise false

  • Returns the last widget in this Container.

  • bbar : Toolbar
    READONLY
    Panel

    Get toolbar Toolbar docked to the bottom of the panel

  • tbar : Toolbar
    READONLY
    Panel

    Get toolbar Toolbar docked to the top of the panel

  • The tools as specified by the tools configuration. Each is a Tool instance which may be hidden, shown and observed and styled just like any other widget.

  • Element (or the id of an element) to append this widget's element to. Can be configured, or set once at runtime. To access the element of a rendered widget, see element.

  • Set HTML content safely, without disturbing sibling elements which may have been added to the contentElement by plugins and features. When specifying html, this widget's element will also have the htmlCls added to its classList, to allow targeted styling.

  • The child element into which content should be placed. This means where html should be put, or, for Containers, where child items should be rendered.

  • Get widgets elements dataset or assign to it

  • Get this widget's encapsulating HTMLElement, which is created along with the widget but added to DOM at render time.

  • focusElement : HTMLElement
    READONLY
    ADVANCED
    Container

    Get this widget's primary focus holding element if this widget is itself focusable, or contains focusable widgets.

  • focusability : Focusability
    internal
    READONLY
    Container

    Returns an object describing the focus and keyboard navigation aspects of this widget's focusElement.

  • Returns this widget's focusElement if that element can currently be given focus (e.g., this widget is not disabled, or hidden).

  • hasPainted : Boolean
    internal
    READONLY
    Container

    This property is set to true after processing the initial paint for the widget. It remains false during the initial paint. The intended use for this flag is to avoid processing that will be handled by the first paint (similar to not firing events during the widget's initial configuration). If this field is true, the initial paint has already taken place, otherwise, it has yet to run. This field differs from isPainted which checks that the widget's element is attached to the DOM.

  • Get/set widgets id

  • Element (or element id) to insert this widget before. If provided, appendTo config is ignored.

  • Element (or element id) to append this widget element to, as a first child. If provided, appendTo config is ignored.

  • The child element which scrolls if any. This means the element used by the scrollable.

  • Returns the DomClassList for this widget's class. This object should not be mutated.

  • Get/set widgets elements style. The setter accepts a cssText string or a style config object, the getter always returns a CSSStyleDeclaration

  • Set to true to make this widget take all available space in the visible viewport.

  • keyMapElement : HTMLElement
    private
    READONLY
    KeyMap

    Override to attach the keyMap keydown event listener to something else than this.element

  • keyMapSubComponents : Object
    private
    READONLY
    KeyMap

    Override to make keyMap resolve subcomponent actions to something else than this.features.

  • Get/set this widget's align-self flexbox setting. This may be set to modify how this widget is aligned within the cross axis of a flexbox layout container.

  • Controls whether the panel is collapsed (the body of the panel is hidden while only the header is visible). Only valid if the panel is collapsible.

  • This property is true if the panel is currently collapsing.

  • collapsingExpanding : Boolean
    internal
    READONLY
    Panel

    This property is true if the panel is currently either collapsing or expanding.

  • This property is true if the panel is currently expanding.

  • Get element's offsetHeight or sets its style.height, or specified height if element no created yet.

  • Get element's margin property. This may be configured as a single number or a TRBL format string. numeric-only values are interpreted as pixels.

  • Get/set element's maxHeight. Getter returns max-height from elements style, which is always a string. Setter accepts either a String or a Number (which will have 'px' appended). Note that like height, reading the value will return the numeric value in pixels.

  • Get/set elements maxWidth. Getter returns max-width from elements style, which is always a string. Setter accepts either a String or a Number (which will have 'px' appended). Note that like width, reading the value will return the numeric value in pixels.

  • Get/set element's minHeight. Getter returns min-height from elements style, which is always a string. Setter accepts either a String or a Number (which will have 'px' appended). Note that like height, reading the value will return the numeric value in pixels.

  • Get/set elements minWidth. Getter returns min-width from elements style, which is always a string. Setter accepts either a String or a Number (which will have 'px' appended). Note that like width, reading the value will return the numeric value in pixels.

  • Accessor to the Scroller which can be used to both set and read scroll information.

  • Get elements offsetWidth or sets its style.width, or specified width if element not created yet.

  • config : Object
    READONLY
    ADVANCED
    Container

    Returns a copy of the full configuration which was used to configure this object.

  • isConstructing : Boolean
    READONLY
    ADVANCED
    Container

    This property is set to true before the constructor returns.

  • isDestroying : Boolean
    READONLY
    ADVANCED
    Container

    This property is set to true on entry to the destroy method. It remains on the objects after returning from destroy(). If isDestroyed is true, this property will also be true, so there is no need to test for both (for example, comp.isDestroying || comp.isDestroyed).

  • assignedId : String
    private
    READONLY
    Container

    Get id assigned by user (not generated id)

  • Get/set element's disabled state. Set to 'inert' to also set the inert DOM attribute.

  • true if no id was set, will use generated id instead (widget1, ...). Toggle automatically on creation

  • This readonly property is true for normal widgets in the items of a container. It is false for special widgets such as a tbar.

  • Get the global LocaleHelper

  • Get the global LocaleManager

  • tab : Tab
    READONLY
    Container

    The tab created for this widget when it is placed in a TabPanel.

  • modalMask : HTMLElement
    internal
    READONLY
    Popup

    Returns the modal mask element for this Popup correctly positioned just below this Popup.

  • Specify true to match fields by their name property only when assigning a record, without falling back to ref.

  • isStateful : Boolean
    READONLY
    ADVANCED
    State

    Returns true if this instance implements the State interface.

  • isStatefulActive : Boolean
    internal
    READONLY
    State

    Returns true if this instance is ready to participate in state activities.

  • Gets or sets a component's state

  • Returns the state key to use for this instance. This will be either the stateId or the id (if explicitly specified and stateful is not false).

  • statefulness : Object
    private
    READONLY
    State

    Returns an object whose truthy keys are the config properties to include in this object's state.

  • Determines visibility by checking if the Widget is hidden, or any ancestor is hidden and that it has an element which is visible in the DOM

  • Programmatic control over which column to start in when used in a grid layout.

  • isComposable : Boolean
    internal
    READONLY
    Container

    Returns true if this class uses compose() to render itself.

  • overflowTwin : Widget
    internal
    READONLY
    Container

    This widget's twin that is placed in an overflow menu when this widget has been hidden by its owner, typically a Toolbar due to overflow. The overflowTwin is created lazily by ensureOverflowTwin.

  • Programmatic control over how many columns to span when used in a grid layout.

  • Get this Widget's next sibling in the parent Container, or, if not in a Container, the next sibling widget in the same parentElement.

  • Get this Widget's parent when used as a child in a Container,

  • Get this Widget's previous sibling in the parent Container, or, if not in a Container, the previous sibling widget in the same parentElement.

  • The number of visible child items shown in this Container.

  • widgetMap : Object<String, Widget>
    READONLY
    Container

    An object which contains a map of descendant widgets keyed by their ref. All descendant widgets will be available in the widgetMap.

Functions

Functions are methods available for calling on the class
  • onClassMixedIn( )
    internal
    static
    Container

    This optional class method is called when a class is mixed in using the mixin() method.

  • emptyCache( )
    internal
    Container

    Clear caches, forces all calls to fromCache to requery dom. Called on render/rerender.

  • Internal function used to hook destroy() calls when using thisObj

  • Internal function used restore hooked destroy() calls when using thisObj

  • doDestroy( )
    internal
    Events

    Auto detaches listeners registered from start, if set as detachable

  • once( )
    private
    Events

    Internal function used to run a callback function after an event is triggered

  • Removes all listeners registered to this object by the application.

  • Only valid for floating Widgets. Moves to the front of the visual stacking order.

  • Called on keyMapElement keyDown

  • Called by the Base constructor after all configs have been applied.

  • Collapse the panel.

  • Expand the panel.

  • close( )
    ASYNC
    Popup

    Performs the configured closeAction upon this popup. By default, the popup hides. The closeAction may be configured as 'destroy'.


    Triggers: beforeClose

  • This method is called following an update to the widget's rendered DOM.

  • Disable the widget

  • Enable the widget

  • Unmask the widget

Events

Events are triggered for certain actions in this class and can be listened for to react to those actions in your code
  • This event is fired after a widget's elements have been synchronized due to a direct or indirect call to recompose, if this results in some change to the widget's rendered DOM elements.

Event handlers

Event handlers are callbacks called as a result of certain actions in this class
  • This event is called after a widget's elements have been synchronized due to a direct or indirect call to recompose, if this results in some change to the widget's rendered DOM elements.

CSS variables

CSS variables that can be set to adjust appearance
Name Description
--b-message-dialog-button-min-width MessageDialog button min-width
--b-message-dialog-min-width MessageDialog min-width

Source path

Core/widget/MessageDialog.js

Contents