summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TDataList.php
diff options
context:
space:
mode:
authorxue <>2007-09-17 12:56:51 +0000
committerxue <>2007-09-17 12:56:51 +0000
commit96f2c4205554f69ffd2d872bcd0dcd87b3a6e571 (patch)
tree21c8ca7ddceaea31f5de1b546d241c8d34781bbb /framework/Web/UI/WebControls/TDataList.php
parent3f5229142af88f0cc44644cc756d908138e5a790 (diff)
fixed renderer bug.
Diffstat (limited to 'framework/Web/UI/WebControls/TDataList.php')
-rw-r--r--framework/Web/UI/WebControls/TDataList.php57
1 files changed, 32 insertions, 25 deletions
diff --git a/framework/Web/UI/WebControls/TDataList.php b/framework/Web/UI/WebControls/TDataList.php
index 5c8ec700..c4da634a 100644
--- a/framework/Web/UI/WebControls/TDataList.php
+++ b/framework/Web/UI/WebControls/TDataList.php
@@ -1173,6 +1173,35 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
return null;
}
+ private function getAlternatingItemDisplay()
+ {
+ if(($classPath=$this->getAlternatingItemRenderer())==='' && ($template=$this->_alternatingItemTemplate)===null)
+ return array($this->getItemRenderer(),$this->_itemTemplate);
+ else
+ return array($classPath,$template);
+ }
+
+ private function getSelectedItemDisplay($itemIndex)
+ {
+ if(($classPath=$this->getSelectedItemRenderer())==='' && ($template=$this->_selectedItemTemplate)===null)
+ {
+ if($itemIndex%2===0)
+ return array($this->getItemRenderer(),$this->_itemTemplate);
+ else
+ return $this->getAlternatingItemDisplay();
+ }
+ else
+ return array($classPath,$template);
+ }
+
+ private function getEditItemDisplay($itemIndex)
+ {
+ if(($classPath=$this->getEditItemRenderer())==='' && ($template=$this->_editItemTemplate)===null)
+ return $this->getSelectedItemDisplay($itemIndex);
+ else
+ return array($classPath,$template);
+ }
+
/**
* Creates a datalist item instance based on the item type and index.
* @param integer zero-based item index
@@ -1190,35 +1219,13 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
$template=$this->_itemTemplate;
break;
case TListItemType::AlternatingItem :
- if(($classPath=$this->getAlternatingItemRenderer())==='')
- $classPath=$this->getItemRenderer();
- $template=$this->_alternatingItemTemplate===null ? $this->_itemTemplate : $this->_alternatingItemTemplate;
+ list($classPath,$template)=$this->getAlternatingItemDisplay();
break;
case TListItemType::SelectedItem:
- if(($classPath=$this->getSelectedItemRenderer())==='')
- {
- if(!($itemIndex%2) || ($classPath=$this->getAlternatingItemRenderer())==='')
- $classPath=$this->getItemRenderer();
- }
- if(($template=$this->_selectedItemTemplate)===null)
- {
- if(!($itemIndex%2) || ($template=$this->_alternatingItemTemplate)===null)
- $template=$this->_itemTemplate;
- }
+ list($classPath,$template)=$this->getSelectedItemDisplay($itemIndex);
break;
case TListItemType::EditItem:
- if(($classPath=$this->getEditItemRenderer())==='')
- {
- if($itemIndex!==$this->getSelectedItemIndex() || ($classPath=$this->getSelectedItemRenderer())==='')
- if(!($itemIndex%2) || ($classPath=$this->getAlternatingItemRenderer())==='')
- $classPath=$this->getItemRenderer();
- }
- if(($template=$this->_editItemTemplate)===null)
- {
- if($itemIndex!==$this->getSelectedItemIndex() || ($template=$this->_selectedItemTemplate)===null)
- if(!($itemIndex%2) || ($template=$this->_alternatingItemTemplate)===null)
- $template=$this->_itemTemplate;
- }
+ list($classPath,$template)=$this->getEditItemDisplay($itemIndex);
break;
case TListItemType::Header :
$classPath=$this->getHeaderRenderer();