From 9a433b428981c1423d35d9ed0e7da904f1236279 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Mar 2016 12:40:52 +0100 Subject: TActiveCheckBoxList cannot be updated during callback, if it was initially empty, since the surrounding span with the control id is not even rendered if there are no items. To allow this, always force the span to be rendered for TActiveCheckBoxList. --- framework/Web/UI/ActiveControls/TActiveCheckBoxList.php | 11 +++++++++++ framework/Web/UI/WebControls/TCheckBoxList.php | 14 +++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'framework/Web/UI') diff --git a/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php b/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php index dfcb72c6..9d9c9099 100644 --- a/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php +++ b/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php @@ -62,6 +62,17 @@ class TActiveCheckBoxList extends TCheckBoxList implements IActiveControl, ICall return $this->getAdapter()->getBaseActiveControl()->getClientSide(); } + /** + * Since at least a control with id is needed to update the content during callback, + * always force the surrounding span to be rendered, so initially empty lists can be + * updated later. + *@return boolean always true + */ + protected function getSpanNeeded () + { + return true; + } + /** * Override parent implementation, no javascript is rendered here instead * the javascript required for active control is registered in {@link addAttributesToRender}. diff --git a/framework/Web/UI/WebControls/TCheckBoxList.php b/framework/Web/UI/WebControls/TCheckBoxList.php index 9225e171..2bf62ff4 100644 --- a/framework/Web/UI/WebControls/TCheckBoxList.php +++ b/framework/Web/UI/WebControls/TCheckBoxList.php @@ -402,13 +402,13 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont */ public function render($writer) { + if ($needSpan=$this->getSpanNeeded()) + { + $writer->addAttribute('id', $this->getClientId()); + $writer->renderBeginTag('span'); + } if($this->getItemCount()>0) { - if ($needSpan=$this->getSpanNeeded()) - { - $writer->addAttribute('id', $this->getClientId()); - $writer->renderBeginTag('span'); - } $this->_isEnabled=$this->getEnabled(true); $repeatInfo=$this->getRepeatInfo(); $accessKey=$this->getAccessKey(); @@ -422,9 +422,9 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont $repeatInfo->renderRepeater($writer,$this); $this->setAccessKey($accessKey); $this->setTabIndex($tabIndex); - if ($needSpan) - $writer->renderEndTag(); } + if ($needSpan) + $writer->renderEndTag(); //checkbox skipped the client control script in addAttributesToRender if($this->getEnabled(true) -- cgit v1.2.3