jQWidgets Forums
jQuery UI Widgets › Forums › Dialogs and Notifications › Window › Window crash
Tagged: javascript dialog window, jqwidgets, jqxwindow
This topic contains 4 replies, has 2 voices, and was last updated by aorlic 12 years, 1 month ago.
-
AuthorWindow crash Posts
-
Hi!
I am trying to create a window always in the same div. It works the first time, but the next one it crashes with the following error in Bugzilla:
TypeError: this.data(…).jqxWindow is undefined
I am invoking “destroy” just before creating a new window and the previous one was closed using the “close” button.
What could cause this problem?
Thanks!
Aleks.
Hi,
You cannot create a window from the same DIV because if you “destroy” the window, that DIV tag is not in the DOM. If you want to do such thing then you will have to dynamically create a new DIV tag, append it to the DOM and initialize the Window from it.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Sorry, I wasn’t clear enough. Of course I am re-appending the DIV, just before I try to create a new window. I just use the same name for it.
So, this is the simplified code to create a Window:
$('body').append('<div id="wnd_main" ><div>' + new_title + '</div><div id="wnd_content"></div></div>'); $('#wnd_main').jqxWindow(conf); // here the window is frozen after the second invocateion$('#wnd_main').jqxWindow('open');
I ensure the DIV is destroyd in the windows “close” event (I even tried it just before the append, with the same failure):
// Close Wnd$('#wnd_main').on('close', function (event) { $('#wnd_main').remove(); // $('#wnd_main').jqxWindow('destroy') produces the same result});
Do you have some clue?
Hi,
I cannot reproduce that behavior with jQWidgets 2.8.3.
Here’s my test code which removes a window and then creates the same window from dynamically created DIV tag with the same ID.
<!DOCTYPE html><html lang="en"><head> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.8.3.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxwindow.js"></script> <script type="text/javascript"> $(document).ready(function () { var window = $("<div id='window1'><div>Title</div><div>Content</div></div>"); $(document.body).append(window); window.jqxWindow(); window.jqxWindow('destroy'); var window = $("<div id='window1'><div>Title</div><div>Content</div></div>"); $(document.body).append(window); window.jqxWindow(); }); </script></head><body class='default'></body></html>
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI am using modal windows. So, please try:
window.jqxWindow({isModal: true});
and you will reproduce the problem.
Thank you!
-
AuthorPosts
You must be logged in to reply to this topic.