Title: A dialog buttons inside a dialog not working Post by: Alfred on April 05, 2019, 09:29:18 PM I open a new dialog which contains a script to open another dialog which has cancel and ok button.
Code: function openDialog(){ Inside Students/All.php, I have the following script: Code: function Note(){ When I run openDialog() to open $('#perDialog') for the first time and run Note() to open $('#note') dialog, the Save and Cancel buttons are working fine. But If I close $('#perDialog') dialog and run openDialog() to open it, and open the $('#note') dialog, the Save Button and Cancel Button in $('#note') dialog are no longer working. What could be the problem? Please help. Title: Re: A dialog buttons inside a dialog not working Post by: jarry on April 07, 2019, 07:12:52 AM When call 'openDialog' function, the 'Students/All' page is loaded and the '#note' dialog is created. When the 'perDialog' dialog is closed and opened, the 'Students/All' page is loaded again and the '#note' dialog is created again. The page exists multiple '#note' dialog components. To solve this issue, release the '#note' dialog when the 'perDialog' is closed. Please try this code.
Code: $('#perDialog').dialog({ Title: Re: A dialog buttons inside a dialog not working Post by: Alfred on April 08, 2019, 05:12:53 AM This solves the problem. Before your solution arrived, I did this way:
Code: var dgContainer= document.getElementById('idcontain'); Now I want a way to do the same with Easyui Desktop dialog. Please can you give me the code. Thanks and regards. Alfred Title: Re: A dialog buttons inside a dialog not working Post by: jarry on April 09, 2019, 01:28:22 AM The 'onLoad' and 'onClose' still can be used to create or release the loaded dialog component.
Code: $('body').desktop('openApp', { Title: Re: A dialog buttons inside a dialog not working Post by: Alfred on April 09, 2019, 04:38:53 AM I already tested this, It does not simply work. For example
$('body').desktop('openApp', { id:'did', icon: 'images/win.png', name: 'About', width: 400, height: 200, href: ..., onLoad: function(){ //... }, onClose: function(){ $('#did').dialog('destroy'); //$(this).dialog('destroy'); } }); If we close the '#did' dialog, we completely destroy the dialog. there is no way we can run the dialog now. But if I want to run the dialog again, how can I recreate the dialog? In my application, I sometimes want to recreate the dialog rather than depending on the existing dialog. Thank you very much. Regards, Alfred Title: Re: A dialog buttons inside a dialog not working Post by: jarry on April 09, 2019, 08:40:08 AM If the dialog exists, set the 'href' to null when calling the 'openApp' method. This will prevent from creating dialog more than once.
Title: Re: A dialog buttons inside a dialog not working Post by: Alfred on April 09, 2019, 09:26:17 AM Thanks for the quick reply. Please can you show me an example code. If I run an OnClose:function(){ $(this).dialog('destroy')}, I could no longer create the desktop dialog.
Thanks and regards, Alfred Title: Re: A dialog buttons inside a dialog not working Post by: jarry on April 09, 2019, 11:45:52 PM Please look at this code. When the window.Note function exists, prevent from loading the dialog content again.
Code: $('body').desktop('openApp', { Title: Re: A dialog buttons inside a dialog not working Post by: Alfred on April 13, 2019, 09:44:04 AM Thanks for your help. One thing I could not understand is: how do I recreate the desktop app? If I run the code pasted down here and close it, the dialog is completely destroyed. How can I recreate the same dialog (desktop app) again?
$('body').desktop('openApp', { id:'winid', icon: 'images/win.png', name: 'About', width: 400, height: 200, href: ..., onLoad: function(){ //..... }, onClose: function(){ $(this).dialog('destroy'); } }); How do I recreate it programmatically? Thanks for your patience and help. Alfred Title: Re: A dialog buttons inside a dialog not working Post by: jarry on April 14, 2019, 07:50:58 PM Calling 'openApp' method will create a desktop window and display it. Closing action will destroy it. Call 'openApp' again to recreate and display it. If you want to custom the 'onClose' event handler, try this code:
Code: onClose: function(){ Title: Re: A dialog buttons inside a dialog not working Post by: Alfred on April 14, 2019, 08:31:54 PM This solve the problem.
Thanks very much. Alfred |