From 304427074ddf629fd2708b23a3fe0cd0122c05a8 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 27 Aug 2006 14:45:57 +0000 Subject: Cells in TDataGrid rows can now be accessed via the corresponding column IDs. Input controls in some datagrid columns can now be accessed in a named fashion. --- .../Web/UI/WebControls/TEditCommandColumn.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'framework/Web/UI/WebControls/TEditCommandColumn.php') diff --git a/framework/Web/UI/WebControls/TEditCommandColumn.php b/framework/Web/UI/WebControls/TEditCommandColumn.php index 65e389bd..c742ef11 100644 --- a/framework/Web/UI/WebControls/TEditCommandColumn.php +++ b/framework/Web/UI/WebControls/TEditCommandColumn.php @@ -38,6 +38,14 @@ Prado::using('System.Web.UI.WebControls.TDataGridColumn'); * properties affect the corresponding properties of the edit and update buttons. * The cancel button does not cause validation by default. * + * The command buttons in the column can be accessed by one of the following methods: + * + * $datagridItem->ButtonColumnID->EditButton (or UpdateButton, CancelButton) + * $datagridItem->ButtonColumnID->Controls[0] + * + * The second method is possible because the button control created within the + * datagrid cell is the first child. + * * @author Qiang Xue * @version $Revision: $ $Date: $ * @package System.Web.UI.WebControls @@ -154,13 +162,21 @@ class TEditCommandColumn extends TDataGridColumn { parent::initializeCell($cell,$columnIndex,$itemType); if($itemType===TDataGrid::IT_ITEM || $itemType===TDataGrid::IT_ALTERNATINGITEM || $itemType===TDataGrid::IT_SELECTEDITEM) - $cell->getControls()->add($this->createButton('Edit',$this->getEditText(),false,'')); + { + $button=$this->createButton('Edit',$this->getEditText(),false,''); + $cell->getControls()->add($button); + $cell->registerObject('EditButton',$button); + } else if($itemType===TDataGrid::IT_EDITITEM) { $controls=$cell->getControls(); - $controls->add($this->createButton('Update',$this->getUpdateText(),$this->getCausesValidation(),$this->getValidationGroup())); + $button=$this->createButton('Update',$this->getUpdateText(),$this->getCausesValidation(),$this->getValidationGroup()); + $controls->add($button); + $cell->registerObject('UpdateButton',$button); $controls->add(' '); - $controls->add($this->createButton('Cancel',$this->getCancelText(),false,'')); + $button=$this->createButton('Cancel',$this->getCancelText(),false,''); + $controls->add($button); + $cell->registerObject('CancelButton',$button); } } -- cgit v1.2.3