diff options
author | xue <> | 2006-07-29 14:43:53 +0000 |
---|---|---|
committer | xue <> | 2006-07-29 14:43:53 +0000 |
commit | e0c9de073cce5b5c9975694c03e2dbe63788bd66 (patch) | |
tree | 0c04506594635064d9f3f62eb45c8aad5c3be685 /framework/Web/UI/WebControls/TListControl.php | |
parent | 6385105e7793509de726b2941d038840c04195c1 (diff) |
Merge from 3.0 branch till 1305.
Diffstat (limited to 'framework/Web/UI/WebControls/TListControl.php')
-rw-r--r-- | framework/Web/UI/WebControls/TListControl.php | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/framework/Web/UI/WebControls/TListControl.php b/framework/Web/UI/WebControls/TListControl.php index bd883590..8c1537b0 100644 --- a/framework/Web/UI/WebControls/TListControl.php +++ b/framework/Web/UI/WebControls/TListControl.php @@ -643,24 +643,53 @@ abstract class TListControl extends TDataBoundControl if($this->_items)
{
$writer->writeLine();
+ $previousGroup=null;
foreach($this->_items as $item)
{
if($item->getEnabled())
{
- if($item->getSelected())
- $writer->addAttribute('selected','selected');
- $writer->addAttribute('value',$item->getValue());
if($item->getHasAttributes())
{
+ $group=$item->getAttributes()->remove('Group');
+ if($group!==$previousGroup)
+ {
+ if($previousGroup!==null)
+ {
+ $writer->renderEndTag();
+ $writer->writeLine();
+ $previousGroup=null;
+ }
+ if($group!==null)
+ {
+ $writer->addAttribute('label',$group);
+ $writer->renderBeginTag('optgroup');
+ $writer->writeLine();
+ $previousGroup=$group;
+ }
+ }
foreach($item->getAttributes() as $name=>$value)
$writer->addAttribute($name,$value);
}
+ else if($previousGroup!==null)
+ {
+ $writer->renderEndTag();
+ $writer->writeLine();
+ $previousGroup=null;
+ }
+ if($item->getSelected())
+ $writer->addAttribute('selected','selected');
+ $writer->addAttribute('value',$item->getValue());
$writer->renderBeginTag('option');
$writer->write(THttpUtility::htmlEncode($item->getText()));
$writer->renderEndTag();
$writer->writeLine();
}
}
+ if($previousGroup!==null)
+ {
+ $writer->renderEndTag();
+ $writer->writeLine();
+ }
}
}
|