summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
authorxue <>2006-08-27 14:45:57 +0000
committerxue <>2006-08-27 14:45:57 +0000
commit304427074ddf629fd2708b23a3fe0cd0122c05a8 (patch)
tree49e86b72451444cb632d38b82ab4e6399ff156ec /framework/Web
parent17f7daf67672f2d2252d9199451fe873d61c2c7a (diff)
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.
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/UI/WebControls/TBoundColumn.php10
-rw-r--r--framework/Web/UI/WebControls/TButtonColumn.php9
-rw-r--r--framework/Web/UI/WebControls/TCheckBoxColumn.php10
-rw-r--r--framework/Web/UI/WebControls/TDataGrid.php5
-rw-r--r--framework/Web/UI/WebControls/TEditCommandColumn.php22
-rw-r--r--framework/Web/UI/WebControls/THyperLinkColumn.php9
6 files changed, 62 insertions, 3 deletions
diff --git a/framework/Web/UI/WebControls/TBoundColumn.php b/framework/Web/UI/WebControls/TBoundColumn.php
index 5975ec02..26fad32b 100644
--- a/framework/Web/UI/WebControls/TBoundColumn.php
+++ b/framework/Web/UI/WebControls/TBoundColumn.php
@@ -26,6 +26,15 @@ Prado::using('System.Web.UI.WebControls.TDataGridColumn');
* If {@link setReadOnly ReadOnly} is false, TBoundColumn will display cells in edit mode
* with textboxes. Otherwise, a static text is displayed.
*
+ * When a datagrid row is in edit mode, the textbox control in the TBoundColumn
+ * can be accessed by one of the following two methods:
+ * <code>
+ * $datagridItem->BoundColumnID->TextBox
+ * $datagridItem->BoundColumnID->Controls[0]
+ * </code>
+ * The second method is possible because the textbox control created within the
+ * datagrid cell is the first child.
+ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
* @package System.Web.UI.WebControls
@@ -103,6 +112,7 @@ class TBoundColumn extends TDataGridColumn
{
$textBox=Prado::createComponent('System.Web.UI.WebControls.TTextBox');
$cell->getControls()->add($textBox);
+ $cell->registerObject('TextBox',$textBox);
$control=$textBox;
}
if(($dataField=$this->getDataField())!=='')
diff --git a/framework/Web/UI/WebControls/TButtonColumn.php b/framework/Web/UI/WebControls/TButtonColumn.php
index 20844f14..fdcf58d3 100644
--- a/framework/Web/UI/WebControls/TButtonColumn.php
+++ b/framework/Web/UI/WebControls/TButtonColumn.php
@@ -39,6 +39,14 @@ Prado::using('System.Web.UI.WebControls.TImageButton');
* The buttons' <b>CausesValidation</b> and <b>ValidationGroup</b> property values
* are determined by the column's corresponding properties.
*
+ * The buttons in the column can be accessed by one of the following two methods:
+ * <code>
+ * $datagridItem->ButtonColumnID->Button
+ * $datagridItem->ButtonColumnID->Controls[0]
+ * </code>
+ * The second method is possible because the button control created within the
+ * datagrid cell is the first child.
+ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
* @package System.Web.UI.WebControls
@@ -238,6 +246,7 @@ class TButtonColumn extends TDataGridColumn
if($this->getDataTextField()!=='' || ($buttonType==='ImageButton' && $this->getDataImageUrlField()!==''))
$button->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
$cell->getControls()->add($button);
+ $cell->registerObject('Button',$button);
}
}
diff --git a/framework/Web/UI/WebControls/TCheckBoxColumn.php b/framework/Web/UI/WebControls/TCheckBoxColumn.php
index 4df1e695..d7fac8cf 100644
--- a/framework/Web/UI/WebControls/TCheckBoxColumn.php
+++ b/framework/Web/UI/WebControls/TCheckBoxColumn.php
@@ -28,6 +28,15 @@ Prado::using('System.Web.UI.WebControls.TCheckBox');
* TCheckBoxColumn will display an enabled checkbox provided the cells are
* in edit mode. Otherwise, the checkboxes will be disabled to prevent from editting.
*
+ * The checkbox control in the TCheckBoxColumn can be accessed by one of
+ * the following two methods:
+ * <code>
+ * $datagridItem->CheckBoxColumnID->CheckBox
+ * $datagridItem->CheckBoxColumnID->Controls[0]
+ * </code>
+ * The second method is possible because the checkbox control created within the
+ * datagrid cell is the first child.
+ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
* @package System.Web.UI.WebControls
@@ -87,6 +96,7 @@ class TCheckBoxColumn extends TDataGridColumn
$checkBox->setEnabled(false);
$cell->setHorizontalAlign('Center');
$cell->getControls()->add($checkBox);
+ $cell->registerObject('CheckBox',$checkBox);
if($this->getDataField()!=='')
$checkBox->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
}
diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php
index e27f6ead..ad30ff3f 100644
--- a/framework/Web/UI/WebControls/TDataGrid.php
+++ b/framework/Web/UI/WebControls/TDataGrid.php
@@ -1075,6 +1075,11 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$cell=new TTableHeaderCell;
else
$cell=new TTableCell;
+ if(($id=$column->getID())!=='')
+ {
+ $cell->setID($id);
+ $item->registerObject($id,$cell);
+ }
$column->initializeCell($cell,$index,$itemType);
$cells->add($cell);
$index++;
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:
+ * <code>
+ * $datagridItem->ButtonColumnID->EditButton (or UpdateButton, CancelButton)
+ * $datagridItem->ButtonColumnID->Controls[0]
+ * </code>
+ * The second method is possible because the button control created within the
+ * datagrid cell is the first child.
+ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @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('&nbsp;');
- $controls->add($this->createButton('Cancel',$this->getCancelText(),false,''));
+ $button=$this->createButton('Cancel',$this->getCancelText(),false,'');
+ $controls->add($button);
+ $cell->registerObject('CancelButton',$button);
}
}
diff --git a/framework/Web/UI/WebControls/THyperLinkColumn.php b/framework/Web/UI/WebControls/THyperLinkColumn.php
index 9fc1e3d2..b8dbb607 100644
--- a/framework/Web/UI/WebControls/THyperLinkColumn.php
+++ b/framework/Web/UI/WebControls/THyperLinkColumn.php
@@ -36,6 +36,14 @@ Prado::using('System.Web.UI.WebControls.THyperLink');
* The same rule applies to {@link setNavigateUrl NavigateUrl} and
* {@link setDataNavigateUrlField DataNavigateUrlField} properties.
*
+ * The hyperlinks in the column can be accessed by one of the following two methods:
+ * <code>
+ * $datagridItem->HyperLinkColumnID->HyperLink
+ * $datagridItem->HyperLinkColumnID->Controls[0]
+ * </code>
+ * The second method is possible because the hyperlink control created within the
+ * datagrid cell is the first child.
+ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
* @package System.Web.UI.WebControls
@@ -178,6 +186,7 @@ class THyperLinkColumn extends TDataGridColumn
if($this->getDataTextField()!=='' || $this->getDataNavigateUrlField()!=='')
$link->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
$cell->getControls()->add($link);
+ $cell->registerObject('HyperLink',$link);
}
}