API/libsapojs/SAPO/Component/Dialog

[Elements] are optional

Class SAPO.Component.Dialog


class SAPO.Component.Dialog

requires SAPO.Utility.Dimensions

Provides alert, confirm and info dialogs. All three dialogs receive an object with options

Defined in Component/Dialog/1.1/lib.js

Function Summary
alert (string message)
alert (Object options)
Renders a html alert box
confirm (string message)
confirm (Object options)
Renders a html confirm box
info (string message)
info (Object options)
Renders a html info box
boolean isInsideComponent (DOMElement elm, string className)
removes a dialog
update the position according to content
updateSize (Number width, Number height, String id, Array toResize)
update the position according to content

Function Details

function alert

alert(string message)
alert(Object options)
Renders a html alert box
Parameters:
Message only
message Message to be shown
Options object
options Options for alert dialog:
  • string message - Message to be shown
  • [ string image ] - Image to be used on button
  • [ string okLabel ] - Text for the button label
  • [ Number width ] - dialog width
  • [ Number height ] - dialog height
  • [ Function onComplete ] - callback called after dialog is rendered. Receives dialog object as a parameter
  • [ function(DOMElement dialog) callBack ] - callback called when dialog is closed with an ok button. Receives dialog object as a parameter
  • [ function(DOMElement dialog) callBackCancel ] - callback called when dialog is closed with a cancel button. Receives dialog object as a parameter
  • [ string className ] - class name which should be applied to the dialog
  • [ elementID|DOMElement targetElementId|targetElement ] - render the dialog and overlay only on this element

function confirm

confirm(string message)
confirm(Object options)
Renders a html confirm box
Parameters:
Message only
message Message to be shown
Options object
options Options for confirm dialog:
  • string message - Message to be shown
  • [ string image ] - Image to be used on OK button
  • [ string imageCancel ] - Image to be used on Cancel button
  • [ string okLabel ] - Text for the OK button label
  • [ string cancelLabel ] - Text for the Cancel label
  • [ Number width ] - dialog width
  • [ Number height ] - dialog height
  • [ Function onComplete ] - callback called after dialog is rendered. Receives dialog object as a parameter
  • [ function(DOMElement dialog) callBack ] - callback called when dialog is closed with an ok button. Receives dialog object as a parameter
  • [ string className ] - class name which should be applied to the dialog
  • [ elementID|DOMElement targetElementId|targetElement ] - render the dialog and overlay only on this element

function info

info(string message)
info(Object options)
Renders a html info box
Parameters:
Message only
message Message to be shown
Options object
options Options for info dialog:
  • string message - Message to be shown
  • [ Number width ] - dialog width
  • [ Number height ] - dialog height
  • [ Function onComplete ] - callback called after dialog is rendered. Receives dialog object as a parameter
  • [ string className ] - class name which should be applied to the dialog
  • [ elementID|DOMElement targetElementId|targetElement ] - render the dialog and overlay only on this element

function isInsideComponent

boolean isInsideComponent(DOMElement elm, string className)
Parameters:
elm - A target element
className - A class name
Returns:
True if the given element is inside another with the given class name.

function removeLayer

removeLayer()
removes a dialog

function updatePosition

updatePosition(String id)
update the position according to content
Parameters:
id - Dialog id

function updateSize

updateSize(Number width, Number height, String id, Array toResize)
update the position according to content
Parameters:
width - new width
height - new height
id - Dialog id
toResize - Additional elements to resize. Array of objects with properties el (new element to resize), width, height, and id (dialog id). Additional property dialog indicates if this is the original dialog resize.