From 233ad780df391ed4af569929c30a1370d2b440ef Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 10 Jun 2006 14:58:25 +0000 Subject: Merge from 3.0 branch till 1150. Fixed the bug that postback js causes controls not inheritable. --- framework/Web/UI/WebControls/TListControl.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'framework/Web/UI/WebControls/TListControl.php') diff --git a/framework/Web/UI/WebControls/TListControl.php b/framework/Web/UI/WebControls/TListControl.php index f20ff4cc..2c42c462 100644 --- a/framework/Web/UI/WebControls/TListControl.php +++ b/framework/Web/UI/WebControls/TListControl.php @@ -113,22 +113,25 @@ abstract class TListControl extends TDataBoundControl $page->ensureRenderInForm($this); if($this->getIsMultiSelect()) $writer->addAttribute('multiple','multiple'); - if($this->getEnabled(true) && $this->getAutoPostBack() && $page->getClientSupportsJavaScript()) - $this->renderClientControlScript($writer); - if(!$this->getEnabled(true) && $this->getEnabled()) + if($this->getEnabled(true)) + { + if($this->getAutoPostBack() && $page->getClientSupportsJavaScript()) + { + $writer->addAttribute('id',$this->getClientID()); + $this->getPage()->getClientScript()->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); + } + } + else if($this->getEnabled()) $writer->addAttribute('disabled','disabled'); parent::addAttributesToRender($writer); } /** - * Renders the client-script code. + * Gets the name of the javascript class responsible for performing postback for this control. + * This method overrides the parent implementation. + * @return string the javascript class name */ - protected function renderClientControlScript($writer) - { - $writer->addAttribute('id',$this->getClientID()); - $cs = $this->getPage()->getClientScript(); - $cs->registerPostBackControl(get_class($this),$this->getPostBackOptions()); - } + abstract protected function getClientClassName(); /** * @return array postback options for JS postback code @@ -812,4 +815,4 @@ class TListItemCollection extends TList } } -?> \ No newline at end of file +?> -- cgit v1.2.3