title | page_title | description |
---|---|---|
Dialog |
Configuration, methods and events of Kendo UI Dialog |
How to initialize a Dialog UI widget and configure its behaviors, center a dialog, set its content and toggle the state of the UI widget. |
Represents the Kendo UI Dialog. Inherits from Widget.
A collection of objects containing text, action and primary attributes used to specify the dialog buttons.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
actions: [{
text: "OK",
action: function(e){
// e.sender is a reference to the dialog widget object
// OK action was clicked
// Returning false will prevent the closing of the dialog
return false;
},
primary: true
},{
text: "Cancel"
}]
});
</script>
The text to be shown in the action's button.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
actions: [{
text: "OK",
}]
});
</script>
The callback function to be called after pressing the action button.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
actions: [{
text: "OK",
action: function(e){
// e.sender is a reference to the dialog widget object
alert("OK action was clicked");
// Returning false will prevent the closing of the dialog
return true;
},
}]
});
</script>
A boolean property indicating whether the action button will be decorated as primary button or not.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
actions: [{
text: "OK",
primary: true
}]
});
</script>
A collection of {Animation} objects, used to change default animations. A value of false
will disable all animations in the widget.
animation:true
is not a valid configuration.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
animation: false
});
</script>
The animation that will be used when a Dialog closes.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
animation: {
close: false
}
});
</script>
Effect to be used for closing of the popup.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
animation: {
close: {
effects: "fade:out"
}
}
});
</script>
Defines the close animation duration.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
animation: {
close: {
duration: 2000
}
}
});
</script>
The animation that will be used when a Dialog opens.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
animation: {
open: false
},
visible: false
});
$("#dialog").data("kendoDialog").open();
</script>
Effect to be used for opening of the popup.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
animation: {
open: {
effects: "fade:in"
}
},
visible: false
});
$("#dialog").data("kendoDialog").open();
</script>
Defines the open animation duration.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
animation: {
open: {
duration: 100
}
},
visible: false
});
$("#dialog").data("kendoDialog").open();
</script>
Specifies the possible layout of the action buttons in the Dialog.
Possible values are:
- normal
- stretched
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
buttonLayout: "normal"
});
</script>
Specifies whether a close button should be rendered at the top corner of the dialog.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
closable: true
});
</script>
Specifies the content of a Dialog.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
content: "<em>Dialog content</em>"
});
</script>
Specifies height of the dialog.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
height: 400
});
</script>
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
height: "50%"
});
</script>
The maximum height (in pixels) that may be achieved by resizing the dialog.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
maxHeight: 300
});
</script>
The maximum width (in pixels) that may be achieved by resizing the dialog.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
maxWidth: 300
});
</script>
Defines the text of the labels that are shown within the dialog. Used primarily for localization.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
messages:{
close: "Close Me!"
}
});
</script>
The title of the close button.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
messages:{
close: "Close Me!"
}
});
</script>
The title of the prompt input.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
messages:{
promptInput: "Input!"
}
});
</script>
The minimum height (in pixels) that may be achieved by resizing the dialog.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
minHeight: 100
});
</script>
The minimum width (in pixels) that may be achieved by resizing the dialog.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
minWidth: 100
});
</script>
Specifies whether the dialog should show a modal overlay over the page.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
modal: true
});
</script>
The text in the dialog title bar. If false
, the dialog will be displayed without a title bar.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
title: "Customer details"
});
</script>
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
title: false
});
</script>
Specifies whether the dialog will be initially visible.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
visible: false
});
setTimeout(function() {
$("#dialog").data("kendoDialog").open();
}, 1000);
</script>
Specifies width of the dialog.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
width: 400
});
</script>
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
width: "50%"
});
</script>
Closes a Dialog.
kendo.ui.Dialog
Returns the dialog object to support chaining.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog();
var dialog = $("#dialog").data("kendoDialog");
setTimeout(function() {
dialog.close();
}, 1000);
</script>
Gets or set the content of a dialog. Supports chaining when used as a setter.
The content of the Dialog. Can be an HTML string or jQuery object.
String
The current dialog content, if used as a getter. If used as a setter, the method will return the dialog object to support chaining.
<div id="dialog">foo</div>
<script>
$("#dialog").kendoDialog();
var dialog = $("#dialog").data("kendoDialog");
console.log(dialog.content()); // logs "foo"
</script>
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog();
var dialog = $("#dialog").data("kendoDialog");
dialog.content("Kendo UI all the things!");
</script>
Destroys the dialog and its modal overlay, if necessary. Removes the widget HTML elements from the DOM.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog();
var dialog = $("#dialog").data("kendoDialog");
dialog.destroy();
</script>
Opens a Dialog and brings it on top of any other open Dialog or Window instances by calling toFront
internally.
kendo.ui.Dialog
Returns the dialog object to support chaining.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
visible: false
});
var dialog = $("#dialog").data("kendoDialog");
dialog.open();
</script>
Gets or sets the title of a Dialog. Can be an HTML string or jQuery object. Supports chaining when used as a setter.
The title of the Dialog.
String
The current dialog title, if used as a getter. If used as a setter, the method will return the dialog object to support chaining.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog();
var dialog = $("#dialog").data("kendoDialog");
var title = dialog.title();
</script>
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog();
var dialog = $("#dialog").data("kendoDialog");
dialog.title("<em>Hello</em>");
</script>
Increases the z-index
style of a Dialog wrapper
to bring the instance on top of other open Dialogs. This method is executed automatically when the open
method is used.
kendo.ui.Dialog
Returns the dialog object to support chaining.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog();
var dialog = $("#dialog").data("kendoDialog");
dialog.toFront();
</script>
Triggered when a Dialog is closed (by a user or through the close() method).
Indicates whether the close action has been triggered by the user (by clicking the close button or hitting the escape key). When the close method has been called, this field is false.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
close: function(e) {
// close animation has finished playing
}
});
</script>
<div id="dialog"></div>
<script>
function dialog_close(e) {
// close animation has finished playing
}
$("#dialog").kendoDialog();
var dialog = $("#dialog").data("kendoDialog");
dialog.bind("close", dialog_close);
</script>
Triggered when a Dialog has finished its closing animation.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
hide: function() {
// close animation is about to finish
}
});
</script>
<div id="dialog"></div>
<script>
function dialog_hide() {
// close animation will start soon
}
$("#dialog").kendoDialog();
var dialog = $("#dialog").data("kendoDialog");
dialog.bind("hide", dialog_hide);
</script>
Triggered when a Dialog is opened for the first time (i.e. the open() method is called).
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
initOpen: function() {
// open animation will start soon
}
});
</script>
<div id="dialog" style="display: none;"></div>
<script>
function dialog_initOpen() {
// open animation will start soon
}
$("#dialog").kendoDialog();
var dialog = $("#dialog").data("kendoDialog");
dialog.bind("initOpen", dialog_initOpen);
dialog.open();
</script>
Triggered when a Dialog is opened (i.e. the open() method is called).
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
open: function() {
// open animation will start soon
}
});
</script>
<div id="dialog"></div>
<script>
function dialog_open() {
// open animation will start soon
}
$("#dialog").kendoDialog();
var dialog = $("#dialog").data("kendoDialog");
dialog.bind("open", dialog_open);
</script>
Triggered when a Dialog has finished its opening animation.
<div id="dialog"></div>
<script>
$("#dialog").kendoDialog({
show: function() {
// open animation has finished playing
}
});
</script>
<div id="dialog"></div>
<script>
function dialog_show() {
// open animation has finished playing
}
$("#dialog").kendoDialog();
var dialog = $("#dialog").data("kendoDialog");
dialog.bind("show", dialog_show);
</script>