summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/UI/ActiveControls/TActiveListControlAdapter.php30
1 files changed, 27 insertions, 3 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveListControlAdapter.php b/framework/Web/UI/ActiveControls/TActiveListControlAdapter.php
index 9bdef077..49cb07c8 100644
--- a/framework/Web/UI/ActiveControls/TActiveListControlAdapter.php
+++ b/framework/Web/UI/ActiveControls/TActiveListControlAdapter.php
@@ -44,8 +44,11 @@ class TActiveListControlAdapter extends TActiveControlAdapter implements IListCo
public function setSelectedIndex($index)
{
if($this->canUpdateClientSide())
+ {
+ $this->updateListItems();
$this->getPage()->getCallbackClient()->select(
$this->getControl(), 'Index', $index);
+ }
}
/**
@@ -56,6 +59,7 @@ class TActiveListControlAdapter extends TActiveControlAdapter implements IListCo
{
if($this->canUpdateClientSide())
{
+ $this->updateListItems();
$n = $this->getControl()->getItemCount();
$list = array();
foreach($indices as $index)
@@ -77,8 +81,11 @@ class TActiveListControlAdapter extends TActiveControlAdapter implements IListCo
public function setSelectedValue($value)
{
if($this->canUpdateClientSide())
+ {
+ $this->updateListItems();
$this->getPage()->getCallbackClient()->select(
$this->getControl(), 'Value', $value);
+ }
}
/**
@@ -89,6 +96,7 @@ class TActiveListControlAdapter extends TActiveControlAdapter implements IListCo
{
if($this->canUpdateClientSide())
{
+ $this->updateListItems();
$list = array();
foreach($values as $value)
$list[] = $value;
@@ -104,7 +112,10 @@ class TActiveListControlAdapter extends TActiveControlAdapter implements IListCo
public function clearSelection()
{
if($this->canUpdateClientSide())
+ {
+ $this->updateListItems();
$this->getPage()->getCallbackClient()->select($this->getControl(), 'Clear');
+ }
}
/**
@@ -112,11 +123,14 @@ class TActiveListControlAdapter extends TActiveControlAdapter implements IListCo
*/
public function updateListItems()
{
- if($this->canUpdateClientSide() && $this->getControl()->getHasItems())
+ if($this->canUpdateClientSide())
{
$items = $this->getControl()->getItems();
- if($items instanceof TActiveListItemCollection && $items->getListHasChanged())
- $this->getPage()->getCallbackClient()->setListItems($this->getControl(), $items);
+ if($items instanceof TActiveListItemCollection
+ && $items->getListHasChanged())
+ {
+ $items->updateClientSide();
+ }
}
}
}
@@ -183,6 +197,16 @@ class TActiveListItemCollection extends TListItemCollection
}
/**
+ * Update client-side list items.
+ */
+ public function updateClientSide()
+ {
+ $client = $this->getControl()->getPage()->getCallbackClient();
+ $client->setListItems($this->getControl(), $this);
+ $this->_hasChanged=false;
+ }
+
+ /**
* Inserts an item into the collection.
* The new option is added on the client-side during callback.
* @param integer the location where the item will be inserted.