Close modal dialog window from webcomponent ( 7.4.6 )

Forum to discuss the Web client version of Servoy.

Close modal dialog window from webcomponent ( 7.4.6 )

Postby poyel » Wed Jan 17, 2018 1:58 pm

Hi to all,
i have a problem when closing a modal-dialog window.

I create a modal dialog in this way
Code: Select all
function openModalDialog ( form, windowName ) {
    var dlg = application.createWindow( (windowName ? windowName : application.getUUID().toString()) ,JSWindow.MODAL_DIALOG );
    dlg.undecorated = true;
    if ( form.setWindowName && ( form.setWindowName instanceof Function ) {
        form.setWindowName( dlg.getName() )
    }
    dlg.show( form );
}


If a close a dialog form by clicking on a button in the form all works well,
Code: Select all
function closeModalDialog ( windowName ) {
   var thisWindow = null;
   if ( windowName ) {
      thisWindow = application.getWindow( windowName );
   }
   if ( thisWindow ) {
      thisWindow.destroy();
   }
}

function closeForm ( ) {
    scopes.UI.closeModalDialog( getWindowName() );
}

but when i call the function to close the window from my webcomponent ( using servoy 7.4.6 ) the modal window is destroyed but remain in webclient and is not possible to close it in any way
Code: Select all
....
function callBackFromWebcomponent ( data ) {
    // do something
    closeForm();
}

function closeForm ( ) {
    scopes.UI.closeModalDialog( getWindowName() );
}

and if i try to get the window again
Code: Select all
application.getWindow( windowName );

the function return null value
Is there a possible bug or i'm wrong something?

Thanks
Marco Alessio Milazzo
- freelance programmer -
Web Developer
Servoy
poyel
 
Posts: 49
Joined: Wed Aug 31, 2011 4:35 pm

Re: Close modal dialog window from webcomponent ( 7.4.6 )

Postby jcompagner » Wed Jan 17, 2018 2:20 pm

What webcomponent are we talking here about?
And where is that component ? is that a component also on the form that is shown in the modal dialog?
It is hard to see what goes wrong here, but i guess some state is not set correct

For example what is in both scenario;s the currentwindow/currentcontroler? (if you print those when closing the dialog) ?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Close modal dialog window from webcomponent ( 7.4.6 )

Postby poyel » Wed Jan 17, 2018 3:47 pm

I'm sorry jcompagner, you're right.
I made a webcomponent using svyComponent module on servoy 7.4.6.
The component is on a modal dialog window that i create with the function of the previous post.
I print the content of currentcontroller.getWindow() before and after close a window.
If i click on a button of the form to close the window i have:
Code: Select all
JSWindow[name:mini,visible:true,destroyed:false,bounds:java.awt.Rectangle[x=80,y=34,width=1119,height=587],title:null]
JSWindow[name:null,visible:true,destroyed:false,bounds:java.awt.Rectangle[x=0,y=0,width=1280,height=656],title:null]

If i open again the window and call the close function from the webcomponent callback i have:
Code: Select all
JSWindow[name:null,visible:true,destroyed:false,bounds:java.awt.Rectangle[x=0,y=0,width=1280,height=656],title:null]
JSWindow[name:null,visible:true,destroyed:false,bounds:java.awt.Rectangle[x=0,y=0,width=1280,height=656],title:null]

So i think that the problem was at the component level, because currentcontroller not get the popup window but always the main window.

What do you think?
Marco Alessio Milazzo
- freelance programmer -
Web Developer
Servoy
poyel
 
Posts: 49
Joined: Wed Aug 31, 2011 4:35 pm

Re: Close modal dialog window from webcomponent ( 7.4.6 )

Postby jcompagner » Mon Jan 22, 2018 2:29 pm

yes something like that is the problem. Your component doesn't set the right active window or something like that.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 3 guests