Created
July 27, 2017 21:18
-
-
Save davecra/fca28639a7c96e1cc1cd8f2bb15f2f18 to your computer and use it in GitHub Desktop.
Using the closeDialogAsync() function you can now open one dialog right after another
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var i = 0; | |
function displayDialog() { | |
var url = "https://localhost:3000/test.html"; | |
Office.context.ui.displayDialogAsync(url,{height:20, width:30, displayInIframe:true}, | |
function (asyncResult) { | |
var dialog = asyncResult.value; // get the dialog | |
var error = asyncResult.error; | |
if(dialog == undefined && error.code > 0) { | |
// log the error | |
console.log(error.message); | |
} else { | |
// attache the events | |
dialog.addEventHandler(Office.EventType.DialogEventReceived, function (arg) { | |
// close this dialog, open the next | |
dialogCloseAsync(dialog, function() { | |
i++; | |
if(i<4) { | |
displayDialog(); | |
} | |
}); | |
}); | |
dialog.addEventHandler(Office.EventType.DialogMessageReceived, function (arg) { | |
// close this dialog, open the next | |
dialogCloseAsync(dialog, function() { | |
i++; | |
if(i<4) { | |
displayDialog(); | |
} | |
}); | |
}); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment