From ddc3ea15bbfd0235fe90f3b2211bf4cc605e25d6 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 13 May 2006 00:21:16 +0000 Subject: Adding TCallbackOptions --- framework/Web/UI/ActiveControls/TCallback.php | 32 ++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'framework/Web/UI/ActiveControls/TCallback.php') diff --git a/framework/Web/UI/ActiveControls/TCallback.php b/framework/Web/UI/ActiveControls/TCallback.php index f42b3143..7bb4ee21 100644 --- a/framework/Web/UI/ActiveControls/TCallback.php +++ b/framework/Web/UI/ActiveControls/TCallback.php @@ -97,9 +97,35 @@ class TCallback extends TControl implements ICallbackEventHandler */ protected function createClientSideOptions() { - return new TCallbackClientSideOptions; + if(($id=$this->getCallbackOptions())!=='' && ($control=$this->findControl($id))!==null) + { + if($control instanceof TCallbackOptions) + return clone($control->getClientSide()); + } + return new TCallbackClientSideOptions; + } + + /** + * Sets the ID of a TCallbackOptions component to duplicate the client-side + * options for this control. The {@link getClientSide ClientSide} + * subproperties has precendent over the CallbackOptions property. + * @param string ID of a TCallbackOptions control from which ClientSide + * options are cloned. + */ + public function setCallbackOptions($value) + { + $this->setViewState('CallbackOptions', $value,''); } + /** + * @return string ID of a TCallbackOptions control from which ClientSide + * options are cloned. + */ + public function getCallbackOptions() + { + return $this->getViewState('CallbackOptions',''); + } + /** * @return boolean whether to perform validation if the callback is * requested. @@ -146,7 +172,7 @@ class TCallback extends TControl implements ICallbackEventHandler /** * @return array list of callback javascript options. */ - protected function getCallbackOptions() + protected function getCallbackClientSideOptions() { $validate = $this->getCausesValidation(); $options['CausesValidation']= $validate ? '' : false; @@ -165,7 +191,7 @@ class TCallback extends TControl implements ICallbackEventHandler { $client = $this->getPage()->getClientScript(); $object = is_null($control) ? $this : $control; - return $client->getCallbackReference($object, $this->getCallbackOptions()); + return $client->getCallbackReference($object, $this->getCallbackClientSideOptions()); } } -- cgit v1.2.3