Popup Window - Multiple Instances

By default, Ignition only opens a single instance or copy of a popup window in the client at a time. However, you can change this behavior and open multiple instances of a popup window in the client.

In this example, suppose you have four tanks in your client. If you click on any one of the four tanks, you will get a popup window that gives you some additional information about that tank.

If you click on another tank, for example Tank 101, the popup window switches to Tank 101, but there are still three windows open: Navigation window, Main window, and a Popup window. (Use the Windows Menubar at the top of the screen to view all open windows in the Client). What happens is when clicking on a different tank reopens the popup window and passes in new parameters. This is the default behavior because the number of open windows you can have at one time is limited in the client. You can change this behavior and have multiple instances of the same window open at once using a script.

images/download/attachments/6034297/Tank_Details_with_Popup_on_one_Tank.png

Opening Multiple Instances of a Popup Window

This example expands on the tank example from the Parameterized Popup Window and UDTs page.

Opening a window will only ever open one copy of any given window. If a popup window is already open, it simply brings it to the front. Sometimes you may want to open a separate popup, one for Tank 100, and one for Tank 101, both at the same time. If this is the case, you can use the system.nav.openWindowInstance function call to open your window.

  1. In Designer, go to your Tank template. Right click on your Template and scroll down to Scripting.

    images/download/attachments/6034297/Tank_Template_Scripting.png

  2. You'll notice that the Navigation tab settings are set to Open / Swap and are passing some Tank parameters over to the popup window. Check the Additional Instance box to make the script open up additional instances of your popup windows. When you click on the Additional Instance box, Ignition automatically enables the navigation script builder. It also tells the script instead of using the same popup window, to open up a new instance if there is another popup window already open instead of switching it out. (To view the script, click on the Script Editor tab. You'll notice the system.nav.openWindowInstance function is used). Click OK.

    images/download/attachments/6034297/Tank_Template_Script_1.png

  3. Save and Publish your project.

  4. Open your Client or if you already have it open, update the client by clicking the yellow bar. Click on each of your Tanks, and you'll see multiple instances of the same popup for each different tank.

images/download/attachments/6034297/Tank_Details_Multiple_Popups.png

Similar Topics ...