jQWidgets Forums

This topic contains 4 replies, has 2 voices, and was last updated by  aorlic 12 years, 1 month ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Window crash Posts
  • Window crash #22065

    aorlic
    Member

    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.

    Window crash #22085

    Peter Stoev
    Keymaster

    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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Window crash #22197

    aorlic
    Member

    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?

    Window crash #22244

    Peter Stoev
    Keymaster

    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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Window crash #22457

    aorlic
    Member

    I am using modal windows. So, please try:

    window.jqxWindow({isModal: true});

    and you will reproduce the problem.

    Thank you!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.