TActivePanel allows the client-side panel contents to be updated during a
callback response using the {@link render} method.
Example: Assume $param is an instance of TCallbackEventParameter attached to
the OnCallback event of a TCallback with ID "callback1", and
"panel1" is the ID of a TActivePanel.
function callback1_requested($sender, $param)
{
$this->panel1->render($param->getNewWriter());
}
/** * Ensure that the ID attribute is rendered and registers the javascript code * for initializing the active control. */ protected function addAttributesToRender($writer) { parent::addAttributesToRender($writer); $writer->addAttribute('id', $this->getClientID()); $options = TJavaScript::encode($this->getPostBackOptions()); $cs = $this->getPage()->getClientScript(); $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); }
public function render($writer) { $this->registerClientScript(); parent::render($writer); }
/** * Overrides parent implementation. Callback {@link renderSelectables()} when * page's IsCallback property is true. */ public function dataBind() { parent::dataBind(); if ($this->getPage()->getIsCallback()) { $this->renderSelectables($this->getResponse()->createHtmlWriter()); } }
/** * 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); } }