cancel
Showing results for 
Search instead for 
Did you mean: 

Open multiple Modal windows (popups) individually from within a for loop

Former Member
0 Kudos

Hi All

I am trying to open a modal window from within a FOR loop, then process an action on that view and destroy the window instance. The modal window opens again on the next pass through the loop. The modal windows displays different data depending on attributes set in the context.

Here is the code:


    for (int i = 0; i < 3; i++)
    {
		IPrivateTestPopupView.IDataNodeElement data = (IPrivateTestPopupView.IDataNodeElement) wdContext.nodeDataNode().createDataNodeElement();
		data.setEmployeeNumber("Employee " + i);
		data.setAge(i + "0");
		wdContext.nodeDataNode().addElement(data);
		
    	wdContext.currentContextElement().setIterator(i);
    	

		IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("TestPopupWindow");
		IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow( windowInfo );
		window.setWindowPosition(300, 150);
		window.show();
		wdContext.currentContextElement().setWindowInstance(window);
    }

My problem is that the FOR loop seems to run through entirely to the end before opening the modal window. Thus my modal window only displays the data where the iterator = 2.

Is there any way I can get the FOR loop to stop until the modal window is destroyed and then continue processing?

Thanks in advance

Anton Kruse

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

"Is there any way I can get the FOR loop to stop until the modal window is destroyed and then continue processing?"

I think no,

Regards

Ayyapparaj

Former Member
0 Kudos

I am not trying to open multiple modal windows. I am trying to open one modal window from within a FOR loop, then close it, then open it again at the next pass of the loop.

I need to stop the FOR loop from processing until I close the modal window.

Any Ideas?

Thanks

Former Member
0 Kudos

hi,

When you are opening a window, then there must be a action(Button) which will close it. OnAction of this button destroy the window and set a boolean attribute in your context to true. Inside your for loop check if this attr is true then only ityerate to the next index.

Hope this will solve your problem.

thanks & regards,

Manoj

former_member182374
Active Contributor
0 Kudos

Hi,

I don't think you can open multiple modal windows because modal window requires user action to return to calling/parent application, so until you close the first window you can't open the 2nd.

Regards,

Omri