From 67f8a9c87ca327619d3469aaae4bc1b0da441628 Mon Sep 17 00:00:00 2001 From: Jens Klaer Date: Tue, 27 Oct 2015 16:58:50 +0100 Subject: calling replace on clientside will now either replace the whole element (like before) or optionally just replace its content this is needed for TJuiDialog (maybe for other jqueryui controls too) because if the element (in case of TJuiDialog the div panel) will be replaced, jqueryui will clean up by calling destroy on dom element removal causing the replaceWith to fail because the parent node is already removed when replacing the original element with the new content. to avoid this, only the inner content will be replaced which is now controlled by an optional parameter for the clientscript replace method. --- framework/Web/UI/JuiControls/TJuiDialog.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'framework/Web/UI/JuiControls/TJuiDialog.php') diff --git a/framework/Web/UI/JuiControls/TJuiDialog.php b/framework/Web/UI/JuiControls/TJuiDialog.php index 7817c3b1..0e369cc2 100644 --- a/framework/Web/UI/JuiControls/TJuiDialog.php +++ b/framework/Web/UI/JuiControls/TJuiDialog.php @@ -164,6 +164,32 @@ class TJuiDialog extends TActivePanel implements IJuiOptions, ICallbackEventHand $code = "jQuery('#".$this->getClientId()."').dialog('".$method."');"; $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); } + + /** + * Rendering as a fieldset is not supported for TJuiDialog. + * @param string the legend text. If this value is not empty, the panel will be rendered as a fieldset. + * @throws TNotSupportedException not supported for TJuiDialog. + */ + public function setGroupingText($value) + { + throw new TNotSupportedException('Rendering as a fieldset is not supported for {0}.', get_class($this)); + } + + /** + * Overrides parent implementation to just render the inner contents and avoid replacing the element itself when + * updating clientside, because replacing/removing will cause jqueryui to fire destroy on the original dialog extension. + * @param THtmlWriter html writer + */ + public function render($writer) + { + if($this->getHasPreRendered() && $this->getActiveControl()->canUpdateClientSide()) + { + parent::renderContents($writer); + $this->getPage()->getCallbackClient()->replaceContent($this, $writer, false); + } + else + parent::render($writer); + } } /** -- cgit v1.2.3