alert of common helpers, Methods Webix Docs

string|functionoptional, the type of an alert modal box or the callback function callback
functionoptional, the callback function (can be used, if the modal box type is defined as a second parameter)
promisethe Promise object

Example

// 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
    });

Related samples

Details

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.

Callbacks

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);
    }
});

See also

Back to top