3 * TTriggeredCallback class file.
5 * @author Wei Zhuo <weizhuo[at]gamil[dot]com>
6 * @link https://github.com/pradosoft/prado
7 * @copyright Copyright © 2005-2016 The PRADO Group
8 * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9 * @package System.Web.UI.ActiveControls
12 Prado::using('System.Web.UI.ActiveControls.TCallback');
14 * TTriggeredCallback abstract Class
16 * Base class for triggered callback controls. The {@link setControlID ControlID}
17 * property sets the control ID to observe the trigger.
19 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
20 * @package System.Web.UI.ActiveControls
23 abstract class TTriggeredCallback extends TCallback
26 * @return string The ID of the server control the trigger is bounded to.
28 public function getControlID()
30 return $this->getViewState('ControlID', '');
34 * @param string The ID of the server control the trigger is bounded to.
36 public function setControlID($value)
38 $this->setViewState('ControlID', $value, '');
42 * @return string target control client ID or html element ID if
43 * control is not found in hierarchy.
45 protected function getTargetControl()
47 $id = $this->getControlID();
48 if(($control=$this->findControl($id)) instanceof TControl)
49 return $control->getClientID();
52 throw new TConfigurationException(
53 'ttriggeredcallback_invalid_controlid', get_class($this));
59 * @return array list of trigger callback options.
61 protected function getTriggerOptions()
63 $options['ID'] = $this->getClientID();
64 $options['EventTarget'] = $this->getUniqueID();
65 $options['ControlID'] = $this->getTargetControl();