Reputation: 1486
I have a ribbon with Login button, which opens the login dialog. I want to limit number of dialogs to one.
I'm using function:
displayDialogAsync(startAddress, options, callback)
All I found is:
An Office Add-in task pane can have only one dialog box open at any time. Multiple dialogs can be open at the same time from Add-in Commands (custom ribbon buttons or menu items).
But I want to use ribbon button. So is there a way to do it? (maybe global variable or smth)
Upvotes: 2
Views: 113
Reputation: 9784
You are going to need a global indicator, but each dialog is a completely separate instance of the JavaScript runtime, so a global variable won't work. You need to use LocalStorage. Try creating a LocalStorage key with a name like isDialogOpen. Your code checks its value before it opens the dialog. If it is false, your code opens the dialog and sets it to true.
Upvotes: 3