Ticket #644 (closed defect: invalid)
QDialogBox duplicates the rendered control when opened/closed multiple times
| Reported by: | mikederfler | Owned by: | |
|---|---|---|---|
| Priority: | important | Milestone: | 2.0.2 Stable |
| Component: | QControls | Version: | 2.0 HEAD |
| Keywords: | QDialogBox | Cc: |
Description
when looking at line 59 of QDialogBox.class.php
return sprintf('$j("#%s").dialog({%s}); $j("#%s").dialog("open");', $this->strControlId, $strOptions, $this->strControlId);
you can see that calling ShowDialogBox? results in creating a new
dialog (.dialog( ... ) ) but when calling close the created dialog dom elements are not deleted. So two elements with the same id ("my_dialog_id") exist. When the dialog gets opened a second time,
the call to $j("my_dialog_id").dialog() creates 2 new elements with "my_dialog_id". if you made changes to the dialog content between the calls the wrong(old) content gets displayed.
Adding one line fixes it:
$strOptions .= ', close: function() { $j(this).remove(); }';
this deletes the generated elements when hitting the close button.

