Modal local data not accessible

How can data be passed in to a Modal dialog?

The sample code for a modal uses the “then” function to deal with the result but all local context is lost within that function. The app, scope or local methods aren’t accessible. So it’s pretty limited in what you can do. Calling the webx.mesage or similar is about it.

webix.modalbox({
    title:"Question",
    buttons:["Yes", "No", "Maybe"],
    text:"Do you love JS?",
    width:500
}).then(function(result){
        switch(result){
            case "0": 
            webix.message("Good!");
// CANNOT ACCESS local functions or variables. 
// Would like to call an event and pass in the context of the modal, e.g. modal-response modal-record-identifier (for record x, the user answered 0)
                break;
            case "1":
            webix.message("Why?..");
                break;
            case "2":
            webix.message("Come back later");
        }   
    }
});

Do you use modal windows in Jet app? Arrow functions will help then.

1 Like