Dialog
Contents |
A dialog widget is a div based popup window that contains a title bar and a content area. The dialog widget can be dragged, resized and close with the X icon.If the content height exceeds the maximum height, a scroll bar will come automatically. An overlay can be turned on by setting modal attribute to true.
The simple way to add Dialog widget to the application is as follows
File /widgets/dialog/Snippet.tpl
title: "Dialog Sample",
icon: "std:info",
width: 400,
maxHeight: 500,
modal: true
The whole list of configuration parameters is available in Dialog.
Action
Dialog widgets are highly configurable, as user can define callback functions for onOpen and onClose events.
File /widgets/dialog/Snippet.tpl
title: "Dialog Sample",
icon: "std:fire",
width: 400,
maxHeight: 500,
onOpen: openDialog,
onCloseClick: closeDialog
Binding
The properties bindable for dialog widget are
- contentMacro
- title
- tooltip
- visible
- xpos
- ypos
- center
If center is set to true, it will have precedence over xpos and ypos, which will be updated according to the actual position of the dialog.
For more information please read the article on Widget Bindings.
Movable dialog
To enable Drag & Drop on a Dialog widget it's enough to set the movable property to true
File /widgets/dialog/Snippet.tpl
id : "sampleDialog"
title: "Dialog Sample",
contentMacro : "dialogMacro"
movable : true
It is possible to specify the desired proxy by setting the movableProxy configuration property:
-
Overlay: a div the same size as the dialog, using a xOverlay class (see above for comments on the style)
File /widgets/dialog/Snippet.tpl
id : "sampleDialog"
title: "Dialog Sample",
contentMacro : "dialogMacro"
movable : true
movableProxy : {
type : "Overlay"
}
-
CloneOverlay: a clone of the dialog
File /widgets/dialog/Snippet.tpl
id : "sampleDialog"
title: "Dialog Sample",
contentMacro : "dialogMacro"
movable : true
movableProxy : {
type : "CloneOverlay",
cfg : {
opacity : 0.7
}
}
The Dialog can only be dragged from its title bar and its movements are constrained to viewport.
The syntax to add listeners on dragstart and dragend is as follow:
File /widgets/dialog/Snippet.tpl
id : "sampleDialog"
title: "Dialog Sample",
contentMacro : "dialogMacro"
movable : true
ondragstart : {
fn : onDragStart
},
ondragend : {
fn : onDragEnd
}
It is possible to set the movable and movableProxy default properties at application level:
File /widgets/dialog/SnippetScript.js
widgetSettings : {
dialog : {
movable : true,
movableProxy : {
type : "Overlay"
}
}
}
Here's a movable dialog example with code:
