summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
authorxue <>2005-12-31 01:56:58 +0000
committerxue <>2005-12-31 01:56:58 +0000
commite050f7f5e259ffc9df018a7021e8ed946b4d614e (patch)
tree7f9c12ac56ba77052a9227c5d231e6cff97bf7f8 /framework/Web
parent21b205564dd4a6602a29b48fb314c4d3d5130ef6 (diff)
Added TDropDownList samples.
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/UI/WebControls/TDropDownList.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/framework/Web/UI/WebControls/TDropDownList.php b/framework/Web/UI/WebControls/TDropDownList.php
index 07549c6c..5e243065 100644
--- a/framework/Web/UI/WebControls/TDropDownList.php
+++ b/framework/Web/UI/WebControls/TDropDownList.php
@@ -10,9 +10,31 @@ class TDropDownList extends TListControl implements IPostBackDataHandler
public function loadPostData($key,$values)
{
+ //TODO: Need to doublecheck!!@!
if(!$this->getEnabled(true))
return false;
- // ensure DataBound???
+ $selections=isset($values[$key])?$values[$key]:null;
+ $this->ensureDataBound();
+ if($selections!==null)
+ {
+ $items=$this->getItems();
+ $selection=is_array($selections)?$selections[0]:$selections;
+ $index=$items->findIndexByValue($selection,false);
+ if($this->getSelectedIndex()!==$index)
+ {
+ $this->setSelectedIndex($index);
+ return true;
+ }
+ else
+ return false;
+ }
+ else if($this->getSelectedIndex()!==-1)
+ {
+ $this->clearSelection();
+ return true;
+ }
+ else
+ return false;
}
public function raisePostDataChangedEvent()