summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TListControl.php
diff options
context:
space:
mode:
authorxue <>2006-02-15 14:02:32 +0000
committerxue <>2006-02-15 14:02:32 +0000
commitba1933d83922e3eb42e93b3fa476f4614a58aebc (patch)
tree9c48973888dd8bf519a4d05710ebb05c6160feed /framework/Web/UI/WebControls/TListControl.php
parentc3c0ba0d974f905a8df0fd467aa9ee41ae74e968 (diff)
TDataFieldAccessor is used consistently to access all data field values.
Diffstat (limited to 'framework/Web/UI/WebControls/TListControl.php')
-rw-r--r--framework/Web/UI/WebControls/TListControl.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/framework/Web/UI/WebControls/TListControl.php b/framework/Web/UI/WebControls/TListControl.php
index 55a46171..67f5555a 100644
--- a/framework/Web/UI/WebControls/TListControl.php
+++ b/framework/Web/UI/WebControls/TListControl.php
@@ -161,15 +161,19 @@ abstract class TListControl extends TDataBoundControl
foreach($data as $key=>$object)
{
$item=new TListItem;
- if(!is_string($object) && isset($object[$textField]))
- $text=$object[$textField];
+ if(is_array($object) || is_object($object))
+ {
+ $text=TDataFieldAccessor::getDataFieldValue($object,$textField);
+ $value=TDataFieldAccessor::getDataFieldValue($object,$valueField);
+ $item->setValue($value);
+ }
else
- $text=TPropertyValue::ensureString($object);
+ {
+ $text=$object;
+ if(is_string($key))
+ $item->setValue($key);
+ }
$item->setText($textFormat===''?$text:sprintf($textFormat,$text));
- if(!is_string($object) && isset($object[$valueField]))
- $item->setValue($object[$valueField]);
- else if(!is_integer($key))
- $item->setValue($key);
$items->add($item);
}
}