Opened 8 years ago

Closed 8 years ago

#8132 closed bug (notabug)

Content loaded via html and used in dialog becomes duplicated

Reported by: Mathachew Owned by: Mathachew
Priority: minor Milestone: 1.9.0
Component: ui.dialog Version: 1.8.17
Keywords: Cc:
Blocked by: Blocking:

Description

I have a table with a list of users and some of the information. When selecting a user, a sidebar is displayed with more detailed information about that user, pulled via ajax. Among the content that is loaded, one of the buttons will bring up a modal whose content is also loaded in the sidebar. Once I close the modal, pull up the next user and try to bring up the same modal, it comes up fine. However, I am unable to close the modal by calling $().dialog('destroy'). Upon inspecting the html, I noticed that the element that was loaded existed twice since the modal moves the element outside of the parent in which it was originally contained.

Change History (3)

comment:1 Changed 8 years ago by Scott González

Owner: set to Mathachew
Status: newpending

I don't think you've described a bug. Please provide a reduced test case showing your problem.

comment:2 in reply to:  1 Changed 8 years ago by Mathachew

Status: pendingnew

Replying to scott.gonzalez:

I don't think you've described a bug. Please provide a reduced test case showing your problem.

http://jsbin.com/ovasab/edit#javascript,html

This is a simplified version of what we're doing, but the result is the same. If I click the link to open multiple modals of the same content, I can then close any additional modals that I was unable to close previously. However, doing this results in multiple elements with the same id. Thanks.

https://s3.amazonaws.com/uploads.hipchat.com/1916/6209/a9chkrkd66om90f/upload.png

comment:3 Changed 8 years ago by Scott González

Resolution: invalid
Status: newclosed

This is expected behavior. The dialog has to move in the DOM for z-index to work properly. You're leaving the dialog in the DOM and then loading new content with the same id and creating another dialog.

Note: See TracTickets for help on using tickets.