summaryrefslogtreecommitdiff
path: root/framework/Web/UI/ActiveControls
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2011-10-21 09:06:19 +0000
committerctrlaltca@gmail.com <>2011-10-21 09:06:19 +0000
commitad678bcd067deafcaa9984b179471fd980465cd8 (patch)
treec59ae3e5c0ad9df602872ab00ab3d90284526952 /framework/Web/UI/ActiveControls
parent22471c977d4edc4ddfe63abe23928d03e659f045 (diff)
fixes #368 + documentation-only addition to TDropDownList, other changes are due to line ending
Diffstat (limited to 'framework/Web/UI/ActiveControls')
-rw-r--r--framework/Web/UI/ActiveControls/TActiveListControlAdapter.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveListControlAdapter.php b/framework/Web/UI/ActiveControls/TActiveListControlAdapter.php
index 30f09d78..66e3e8d1 100644
--- a/framework/Web/UI/ActiveControls/TActiveListControlAdapter.php
+++ b/framework/Web/UI/ActiveControls/TActiveListControlAdapter.php
@@ -46,6 +46,15 @@ class TActiveListControlAdapter extends TActiveControlAdapter implements IListCo
if($this->canUpdateClientSide())
{
$this->updateListItems();
+ // if a prompt is set, we mimic the postback behaviour of not counting it
+ // in the index. We assume the prompt is _always_ the first item (Issue #368)
+ $promptValue=$this->getControl()->getPromptValue();
+ if($promptValue==='')
+ $promptValue=$this->getControl()->getPromptText();
+ if($promptValue!=='')
+ $index++;
+
+ if($index >= 0 && $index <= $this->getControl()->getItemCount())
$this->getPage()->getCallbackClient()->select(
$this->getControl(), 'Index', $index);
}
@@ -61,10 +70,17 @@ class TActiveListControlAdapter extends TActiveControlAdapter implements IListCo
{
$this->updateListItems();
$n = $this->getControl()->getItemCount();
+
+ $promptValue=$this->getControl()->getPromptValue();
+ if($promptValue==='')
+ $promptValue=$this->getControl()->getPromptText();
+
$list = array();
foreach($indices as $index)
{
$index = intval($index);
+ if($promptValue!=='')
+ $index++;
if($index >= 0 && $index <= $n)
$list[] = $index;
}
@@ -114,7 +130,14 @@ class TActiveListControlAdapter extends TActiveControlAdapter implements IListCo
if($this->canUpdateClientSide())
{
$this->updateListItems();
- $this->getPage()->getCallbackClient()->select($this->getControl(), 'Clear');
+ if($this->getControl() instanceof TActiveDropDownList)
+ {
+ // clearing a TActiveDropDownList's selection actually doesn't select the first item;
+ // we mimic the postback behaviour selecting it (Issue #368)
+ $this->getPage()->getCallbackClient()->select($this->getControl(), 'Index', 0);
+ } else {
+ $this->getPage()->getCallbackClient()->select($this->getControl(), 'Clear');
+ }
}
}