From 98ffb7a2cb6144de626093bdf5009444661f957c Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 28 Jun 2006 01:36:35 +0000 Subject: Fixed #256, #257. --- HISTORY | 2 ++ framework/Web/UI/WebControls/TDataGrid.php | 2 +- framework/Web/UI/WebControls/TDataGridColumn.php | 22 ++++++++++++++++++++++ framework/Web/UI/WebControls/TDataList.php | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/HISTORY b/HISTORY index 39b1e90d..3fa0bc00 100644 --- a/HISTORY +++ b/HISTORY @@ -14,6 +14,8 @@ ENH: Ticket#206 - Added OnValidate, OnError, OnSuccess events to validators (Qia ENH: Ticket#230 - Added TDataList.EmptyTemplate property (Qiang) ENH: Ticket#231 - Added TButton.ButtonType property to allow reset button (Qiang) ENH: Ticket#232 - Allow <%# %> and <%= %> embedded within property values (Qiang) +ENH: Ticket#256 - Datagrid columns can now be accessed via IDs (Qiang) +ENH: Ticket#257 - OnSelectedIndexChanged event of TDataList and TDataGrid now passes the original command parameter (Qiang) ENH: TRepeater, TDataList and TDataGrid will store data indices in DataKeys if DataKeyField is not set. (Qiang) ENH: Added TPageService.BasePageClass property (Qiang) ENH: Added TDataGrid.EmptyTemplate property (Qiang) diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php index 342a39ac..f811edaf 100644 --- a/framework/Web/UI/WebControls/TDataGrid.php +++ b/framework/Web/UI/WebControls/TDataGrid.php @@ -634,7 +634,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer if(strcasecmp($command,self::CMD_SELECT)===0) { $this->setSelectedItemIndex($param->getItem()->getItemIndex()); - $this->onSelectedIndexChanged(null); + $this->onSelectedIndexChanged($param); return true; } else if(strcasecmp($command,self::CMD_EDIT)===0) diff --git a/framework/Web/UI/WebControls/TDataGridColumn.php b/framework/Web/UI/WebControls/TDataGridColumn.php index e43b4895..fcb2e261 100644 --- a/framework/Web/UI/WebControls/TDataGridColumn.php +++ b/framework/Web/UI/WebControls/TDataGridColumn.php @@ -51,9 +51,31 @@ Prado::using('System.Util.TDataFieldAccessor'); */ abstract class TDataGridColumn extends TApplicationComponent { + private $_id=''; private $_owner=null; private $_viewState=array(); + /** + * @return string the ID of the column. + */ + public function getID() + { + return $this->_id; + } + + /** + * Sets the ID of the column. + * By explicitly specifying the column ID, one can access the column + * by $templateControl->ColumnID. + * @param string the ID of the column. + */ + public function setID($value) + { + if(!preg_match(TControl::ID_FORMAT,$value)) + throw new TInvalidDataValueException('datagridcolumn_id_invalid',get_class($this),$value); + $this->_id=$value; + } + /** * @return string the text to be displayed in the header of this column */ diff --git a/framework/Web/UI/WebControls/TDataList.php b/framework/Web/UI/WebControls/TDataList.php index b6888225..48392b1d 100644 --- a/framework/Web/UI/WebControls/TDataList.php +++ b/framework/Web/UI/WebControls/TDataList.php @@ -677,7 +677,7 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs if(strcasecmp($command,self::CMD_SELECT)===0) { $this->setSelectedItemIndex($param->getItem()->getItemIndex()); - $this->onSelectedIndexChanged(null); + $this->onSelectedIndexChanged($param); return true; } else if(strcasecmp($command,self::CMD_EDIT)===0) -- cgit v1.2.3