creates an alert box
text | string|object | mandatory, the box text as a string, or the box configuration object |
type | string|function | optional, the type of an alert modal box or the callback function |
callback | function | optional, the callback function (can be used, if the modal box type is defined as a second parameter) |
promise | the Promise object |
// basic initialization
webix.alert("Test alert","alert-warning").then(function(result){
// some action
});
// extended initialization
webix.alert({
title: "Close",
text: "You can't close this window!",
type:"alert-error"
}).then(function(result){
// some action
});
The method can be used in several ways:
1. Basic form - contains several parameters: text (mandatory) and type.
webix.alert("Test alert","alert-warning");
In the basic form, the method may take the following parameters:
2. Extended form - contains an object with several available parameters. Non-specified parameters take default values.
webix.alert({
title:"Custom title",
ok:"Custom text",
text:"Result: yes",
type:"alert-warning"
});
In the extended form, the method takes one parameter - an object with box parameters. The parameters are:
The full list of possible box parameters is given in the related article.
Since webix.alert() returns a promise, there is no need in a callback functions. However, you can add a callback if this is necessary. As a parameter, the function receives the alert result status (true).
// basic form
webix.alert("Test alert","alert-warning",function(result){
webix.message(result);
});
// extended form
webix.alert({
title: "Close",
text: "You can't close this window!",
type:"alert-error",
callback:function(result){
webix.message(result);
}
});