DHTMLX Touch documentation

How to create alert(confirm) window?

DHTMLX Touch simplified creating alert and confirm messages by means of 2 commands: dhx.alert() and dhx.confirm().
Let's know how to use them.

dhx.alert()

By calling this command you create alert window (exists in the only copy).

Parameters

  • title - (string) the text of the header
  • message - (string) the text of the window body
  • width - (integer) the width of the window
  • height - (integer) the height of the window
  • position - (right, center or left ) the alignment of the window's body text
  • callback - (function) contains code that will be called on the button click.
dhx.alert({
		title: "Close",
		message: "You can't close this window!",
		callback: alert2
})
function alert2() {
             dhx.alert("You closed me")
}

There is the other way to call this command.

dhx.alert("AlertText");

It's analogous to the following calling statement:

dhx.alert({
		title: "Info",
		message: "AlertText",
		width: 300,// the default width value
		height: 200, // the default height value
		position: "center", // the default text alignment
		callback: ""
})

dhx.alert()

By calling this command you create confirm window (exists in the only copy).

Parameters

  • title - (string) the text of the header
  • message - (string) the text of the window body
  • callback - (function) contains code that will be called on the button click. Gets 'true' or 'false' subject to the clicked button.
dhx.confirm({
		title: "Close",
		message: "Are you sure you want to do it?",
		callback: function(result) {
			if (result) 
				dhx.alert("You have select 'Ok'");
			else
				dhx.alert({
					message:"You have select 'Cancel'",
					callback:function(){
						dhx.confirm("Still want to try?");
					}
				});
		}
});

You also have the other way to call this command:

dhx.confirm("ConfirmText");

It's analogous to the following calling statement:

dhx.confirm({
		title: "Info",
		message: "ConfirmText",
		width: 300,// the default width value
		height: 200, // the default height value
		position: "center", // the default text alignment
		callback: ""
})