Hitesh
Hitesh

Reputation: 1228

2 task pane open when clicking on 2 buttons from ribbon in office 365 word add in

I have 2 buttons on the ribbon in Office 365 word addin.

...
<Action xsi:type="ShowTaskpane">                        
   <TaskpaneId>button1</TaskpaneId>
   <SourceLocation resid="myURL" /> // ~remoteURL/pages/text.html?seacrhtype=1
</Action>
...

..
<Action xsi:type="ShowTaskpane">                        
   <TaskpaneId>button2</TaskpaneId>
   <SourceLocation resid="MyURL.Url" /> //// ~remoteURL/pages/text.html?seacrhtype=2
</Action>
..

I open the same html page and pass query param based on which ribbon's button click.

The issue which I am facing is that when I click on a button1, it opens a task pane.

If I click on button2, it opens another task pane without hiding/closing the first task pane which already opened so I have 2 task pane on the same word page.

Is there any way so at a time, only one task will be open? If I click on a different button then only that related taskpane will open and work.

How can I hide the first task pane when I click on the second button and vice versa?

Thanks in advance

Upvotes: 1

Views: 223

Answers (1)

Eugene Astafiev
Eugene Astafiev

Reputation: 49455

The closeContainer method closes the UI container where the JavaScript is executing. The behavior of this method is specified by the following:

  • Called from a UI-less command button: No effect. Any dialog opened by displayDialogAsync will remain open.
  • Called from a task pane: The task pane will close. Any dialog opened by displayDialogAsync will also close. If the task pane supports pinning and was pinned by the user, it will be un-pinned.
  • Called from a module extension: No effect.

Upvotes: 0

Related Questions