Hello,
If a dialog is opened and destroyed the div used as dialogcontent will be removed from its original position and will be appended to the body. This becomes a problem when using partial page updates, because the div will move out of the scope of the update. If the update creates the div again it will exist twice now, including all the problems like not unique IDs.
I have got two ideas to fix this.
Alternative 1:
Memorize the parent elementAdd following line to the
_create function
- this.parentElement = this.element.context.parentNode;
In
open function it can be used like this
- uiDialog.appendTo(this.parentElement);
And in the
destroy function
- .hide().appendTo(this.parentElement);
Alternative 2:
Set the target element as optionA new option could look like
- parentElement: 'body'
In
open function it can be used like this
- uiDialog.appendTo(self.options.parentElement);
And in the
destroy function
- .hide().appendTo(self.options.parentElement);
<edit>
For a dialog, that is not autoopening an additional code modification is needed
In
_create function:
- uiDialog = (self.uiDialog = $('<div></div>'))
- .appendTo(this.parentElement)
</edit>
Tested with JQuery UI Version 1.8.1
Greetings,
MaKraus