diff options
Diffstat (limited to 'framework/Web/UI')
-rw-r--r-- | framework/Web/UI/WebControls/TDropDownList.php | 24 |
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()
|