new BootstrapDialog(opt_domHelper)
This class is a re-implementation of goog.ui.Dialog to
create a bootstrap (css style) compatible modal dialog
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
opt_domHelper |
goog.dom.DomHelper |
<optional> |
Optional dom helper |
- Source:
Extends
- goog.ui.ModalPopup
Methods
-
addButton(button, opt_isDefault, opt_isCancel, opt_css)
-
This function adds a button to the dialog. Buttons must be added before the dialog is rendered. A user can either add an existing button element, or a {key: string, caption: string} object that will be rendered as button
Parameters:
Name Type Argument Description button
HTMLButtonElement | Object The button to add opt_isDefault
boolean <optional>
Whether the button is the default button. Results in css class 'btn-primary' if the button parameter is not an existing HTML element opt_isCancel
boolean <optional>
Whether this is a cancel button opt_css
string <optional>
Optional css class to use for the button in case the button parameter is not an existing HTML element - Source:
-
canDecorate(element) → {boolean}
-
Yes we can!
Parameters:
Name Type Description element
Element Element to decorate - Source:
Returns:
True if the element can be decorated, false otherwise- Type
- boolean
-
createDom()
-
- Source:
-
decorateInternal(element)
-
Decorates the element for the UI component. If the element is in the document, the enterDocument method will be called. Any buttons *must* be inside a 'modal-footer' element, otherwise they are not added to the set of handled buttons A cancel button must have 'data-dismiss' attribute and the default button a 'data-role' attribute set to the value 'default'
Parameters:
Name Type Description element
Element Element to decorate - Source:
-
disposeInternal()
-
- Source:
-
enterDocument()
-
- Source:
-
exitDocument()
-
- Source:
-
focus()
-
Focuses the dialog contents and the default dialog button if there is one
- Source:
-
getBodyContentAsString() → {string}
-
Gets the content HTML of the body element as a plain string. If the body element exists, then this returns the 'innerHTML' property. Otherwise it returns the content as set by the users, converted to a string
- Source:
Returns:
Content HTML- Type
- string
-
getButton(key) → {HTMLButtonElement}
-
This function returns the HTML of a button or null if the button is not found
Parameters:
Name Type Description key
string The key of the button to get - Source:
Returns:
The button or null- Type
- HTMLButtonElement
-
getButtonElement() → {Element}
-
Returns the button element so that more complicated things can be done with the button area. Renders if the DOM is not yet created
- Source:
Returns:
The button container element- Type
- Element
-
getContentElement() → {Element}
-
Returns the body element so that more complicated things can be done with the content area. Renders if the DOM is not yet created. Overrides goog.ui.Component#getContentElement
- Source:
Returns:
The content element- Type
- Element
-
getCssClass()
-
- Source:
-
getFooter() → {Element}
-
Returns the footer element so that more complicated things can be done with it. Renders if the DOM is not yet created
- Source:
Returns:
The button container element- Type
- Element
-
getHeaderElement() → {Element}
-
Returns the header element so that more complicated things can be done. Renders if the DOM is not yet created
- Source:
Returns:
The header element- Type
- Element
-
getPreferredAriaRole() → {goog.a11y.aria.Role}
-
Returns the dialog's preferred ARIA role. This can be used to override the default dialog role, e.g. with an ARIA role of ALERTDIALOG for a simple warning or confirmation dialog
- Source:
Returns:
This dialog's preferred ARIA role- Type
- goog.a11y.aria.Role
-
getTitleCloseElement() → {HTMLButtonElement}
-
Returns the title close element so that more complicated things can be done with the close area of the title. Renders if the DOM is not yet created
- Source:
Returns:
The close box- Type
- HTMLButtonElement
-
getTitleElement() → {Element}
-
Returns the title element so that more complicated things can be done with the title. Renders if the DOM is not yet created
- Source:
Returns:
The title element- Type
- Element
-
<protected> onResize(e)
-
Callback for when viewport size changed. This simply re-centers the dialog
Parameters:
Name Type Description e
goog.events.Event - Source:
-
setBodyContent(body)
-
Setter for the body element
Parameters:
Name Type Description body
string | Element | goog.html.SafeHtml The body text or HTML - Source:
-
setDisposeOnHide(b)
-
Whether the dialog should be disposed off on close
Parameters:
Name Type Description b
boolean The value to set - Source:
-
setFooter(footer)
-
Setter for the footer element
Parameters:
Name Type Description footer
string | Element The footer text or HTML content - Source:
-
setPreferredAriaRole(role)
-
Sets the dialog's preferred ARIA role. This can be used to override the default dialog role, e.g. with an ARIA role of ALERTDIALOG for a simple warning or confirmation dialog
Parameters:
Name Type Description role
goog.a11y.aria.Role This dialog's preferred ARIA role - Source:
-
setSafeHtmlContent(html)
-
Allows arbitrary HTML to be set in the content element
Parameters:
Name Type Description html
goog.html.SafeHtml Content HTML - Source:
-
setTitle(title)
-
Setter for the title element
Parameters:
Name Type Description title
string | Element The title text or HTML content - Source:
-
setVisible(visible)
-
Parameters:
Name Type Description visible
boolean Whether to show or hide the dialog - Source: