How do I close an Inline Dialog from inside the callback function?

Robert Massaioli _Atlassian_
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 29, 2014

I have an InlineDialog that I declare like this:

var inlineDialog = AJS.InlineDialog(AJS.$(this), "dialog-" + appId, function(content, trigger, showPopup) {

                var self = this;

                content.html(Mustache.render(MUSTACHE_TEMPLATES['reset-spam-key-warning'], {}));

    

                // Act upon the delete button

                content.find(".actions .delete-button").click(function(event) {

                    event.preventDefault();

                    console.log("Clicked delete.");

    

                });

    

                showPopup();

            });

I want to write something so that I can close the dialog when the delete button is clicked. How do I make that happen? The problem is that I really don't have access to an inlineDialog close function from in there.

1 answer

1 accepted

1 vote
Answer accepted
Daz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 29, 2014

here's how you cheat:

var inlineDialog;
var closer = function() {
    if (inlineDialog) {
        inlineDialog.hide();
    }
}
inlineDialog = AJS.InlineDialog(..., ..., function(content, trigger, showPopup) {
    // ...
    content.find(...).click(function(e) {
        closer();
    });
});

Robert Massaioli _Atlassian_
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 29, 2014

Nice cheat. Works a charm. I was in the process of trying something similar.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events