The TCallbackEventParameter provides the parameter passed during the callback
request in the {@link getCallbackParameter CallbackParameter} property. The
callback response content (e.g. new HTML content) must be rendered
using an THtmlWriter obtained from the {@link getNewWriter NewWriter}
property, which returns a NEW instance of TCallbackResponseWriter.
Each instance TCallbackResponseWriter is associated with a unique
boundary delimited. By default each panel only renders its own content.
To replace the content of ONE panel with that of rendered from multiple panels
use the same writer instance for the panels to be rendered.
The response data (i.e., passing results back to the client-side
callback handler function) can be set using {@link setResponseData ResponseData} property.
/** * Event handler to the OnCallback active buttons or active dropdownlist. * This handler will raise the {@link onCallback OnCallback} event * * @param mixed $sender * @param TCallbackEventParameter $param */ public function handleCallback($sender, $param) { // Update all the buttons pagers attached to the same control. // Dropdown pagers doesn't need to be re-rendered. $controlToPaginate = $this->getControlToPaginate(); foreach ($this->getNamingContainer()->findControlsByType('TActivePager', false) as $control) { if ($control->getMode() !== TPagerMode::DropDownList && $control->getControlToPaginate() === $controlToPaginate) { $control->render($param->getNewWriter()); // FIXME : With some very fast machine, the getNewWriter() consecutive calls are in the same microsecond, resulting // of getting the same boundaries in ajax response. Wait 1 microsecond to avoid this. usleep(1); } } // Raise callback event $this->onCallback($param); }