From 064053a81f4ce4e9cef5e8984dadfe7cca049fb9 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Mon, 30 Sep 2013 17:36:51 +0200 Subject: Fix use of TCallbackOptions with TActiveCheckBoxList, TActiveRadioButtonList, TActiveRatingList --- framework/Web/UI/ActiveControls/TActiveCheckBoxList.php | 12 ++++++++++++ framework/Web/UI/ActiveControls/TActiveRadioButtonList.php | 11 +++++++++++ framework/Web/UI/ActiveControls/TActiveRatingList.php | 11 +++++++++++ framework/Web/UI/ActiveControls/TBaseActiveControl.php | 4 +++- 4 files changed, 37 insertions(+), 1 deletion(-) (limited to 'framework/Web/UI/ActiveControls') diff --git a/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php b/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php index d51c4d95..a42044fb 100644 --- a/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php +++ b/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php @@ -105,5 +105,17 @@ class TActiveCheckBoxList extends TCheckBoxList implements IActiveControl, ICall { $this->raiseEvent('OnCallback', $this, $param); } + + /** + * Ensure that the ID attribute is rendered and registers the javascript code + * for initializing the active control. + */ + protected function addAttributesToRender($writer) + { + parent::addAttributesToRender($writer); + $this->getActiveControl()->registerCallbackClientScript( + $this->getClientClassName(), $this->getPostBackOptions()); + } + } diff --git a/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php b/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php index c106f479..3244ce11 100644 --- a/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php +++ b/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php @@ -106,5 +106,16 @@ class TActiveRadioButtonList extends TRadioButtonList implements IActiveControl, { $this->raiseEvent('OnCallback', $this, $param); } + + /** + * Ensure that the ID attribute is rendered and registers the javascript code + * for initializing the active control. + */ + protected function addAttributesToRender($writer) + { + parent::addAttributesToRender($writer); + $this->getActiveControl()->registerCallbackClientScript( + $this->getClientClassName(), $this->getPostBackOptions()); + } } diff --git a/framework/Web/UI/ActiveControls/TActiveRatingList.php b/framework/Web/UI/ActiveControls/TActiveRatingList.php index 973dc1e5..022efe65 100644 --- a/framework/Web/UI/ActiveControls/TActiveRatingList.php +++ b/framework/Web/UI/ActiveControls/TActiveRatingList.php @@ -120,6 +120,17 @@ class TActiveRatingList extends TRatingList implements IActiveControl, ICallback $this->callClientFunction('setCaption',$value); } + /** + * Ensure that the ID attribute is rendered and registers the javascript code + * for initializing the active control. + */ + protected function addAttributesToRender($writer) + { + parent::addAttributesToRender($writer); + $this->getActiveControl()->registerCallbackClientScript( + $this->getClientClassName(), $this->getPostBackOptions()); + } + /** * Gets the name of the javascript class responsible for performing postback for this control. * This method overrides the parent implementation. diff --git a/framework/Web/UI/ActiveControls/TBaseActiveControl.php b/framework/Web/UI/ActiveControls/TBaseActiveControl.php index 73503f3c..61230719 100644 --- a/framework/Web/UI/ActiveControls/TBaseActiveControl.php +++ b/framework/Web/UI/ActiveControls/TBaseActiveControl.php @@ -239,7 +239,9 @@ class TBaseActiveCallbackControl extends TBaseActiveControl } else { - $control=$this->getControl()->findControl($id); + // TCheckBoxList overrides findControl() with a fake implementation + // but accepts a second parameter to use the standard one + $control=$this->getControl()->findControl($id, true); } if($control instanceof TCallbackOptions) -- cgit v1.2.3