jQWidgets Forums

jQuery UI Widgets Forums Dialogs and Notifications Window Using setContent seems to break buttons

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 10 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • jonfrain
    Participant

    Hello,

    If I create the content manually as follows it handles the cancelButton being pressed:

    <div id='deleteUserWindow' >
        <div id="deleteUserWindowHeader">
            <!-- title of span is set dynamically -->
            <span id="captureContainer" style="float: left">Delete User Confirmation</span>
        </div>
        <div id="deleteUserWindowContent" style="overflow: hidden">
            </br></br>Are you sure you want to delete user:</br></br> 
           
    
            <input style="margin-top: 10px;" type="submit" name="Submit" value="Submit" id="submitButton" />&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="button" value="Cancel" id="cancelButton" />
        </div>
    </div>

    But if I try to prepend the content and then show the window the cancel button isn’t recognized as being pressed:

    var str = " Are you sure you want to delete User: " + $("#userName-" + currentId).html() + ' ?</br></br>';
    var content = str +  $('#deleteUserWindow').jqxWindow('content'); 
    $('#deleteUserWindow').jqxWindow('setContent', content);
    
    // move window and open!!
    $('#deleteUserWindow').jqxWindow('open');
    

    Peter Stoev
    Keymaster

    Hello jonfrain,

    setContent replaces your window’s content with new HTML. If your buttons are part of the content then they will be removed or replaced depending on whether you have or have not buttons in your new content. When you replace content, you will lose the Click handlers and that’s normal and should be expected, because you have new HTML Elements.

    Best Regards,
    Peter Stoev

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

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

You must be logged in to reply to this topic.