From 3e1e120dbfbde806bcc0331479d28ce2a0bc2dbf Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 9 Apr 2007 03:32:50 +0000 Subject: Added getDataChanged() to IPostBackDataHandler --- framework/Web/UI/WebControls/TListBox.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'framework/Web/UI/WebControls/TListBox.php') diff --git a/framework/Web/UI/WebControls/TListBox.php b/framework/Web/UI/WebControls/TListBox.php index c49e2561..6112915f 100644 --- a/framework/Web/UI/WebControls/TListBox.php +++ b/framework/Web/UI/WebControls/TListBox.php @@ -38,6 +38,8 @@ Prado::using('System.Web.UI.WebControls.TListControl'); */ class TListBox extends TListControl implements IPostBackDataHandler, IValidatable { + private $_dataChanged=false; + /** * Adds attribute name-value pairs to renderer. * This method overrides the parent implementation with additional list box specific attributes. @@ -99,7 +101,7 @@ class TListBox extends TListControl implements IPostBackDataHandler, IValidatabl if($this->getSelectedIndex()!==$index) { $this->setSelectedIndex($index); - return true; + return $this->_dataChanged=true; } else return false; @@ -127,13 +129,16 @@ class TListBox extends TListControl implements IPostBackDataHandler, IValidatabl else $flag=true; if($flag) + { $this->setSelectedIndices($list); + $this->_dataChanged=true; + } return $flag; } else if($this->getSelectedIndex()!==-1) { $this->clearSelection(); - return true; + return $this->_dataChanged=true; } else return false; @@ -153,6 +158,16 @@ class TListBox extends TListControl implements IPostBackDataHandler, IValidatabl $this->onSelectedIndexChanged(null); } + /** + * Returns a value indicating whether postback has caused the control data change. + * This method is required by the IPostBackDataHandler interface. + * @return boolean whether postback has caused the control data change. False if the page is not in postback mode. + */ + public function getDataChanged() + { + return $this->_dataChanged; + } + /** * @return boolean whether this control allows multiple selection */ -- cgit v1.2.3