summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls
diff options
context:
space:
mode:
authorxue <>2007-02-06 18:02:21 +0000
committerxue <>2007-02-06 18:02:21 +0000
commit69fa043ebb880ce8164691d81be7f24e972d8639 (patch)
treea2298296a36bb29610a26e1b2feb1cc6045ff0a8 /framework/Web/UI/WebControls
parent7c4c3271118a0bdd8a1d7b85def3899911b00835 (diff)
updated comments about renderer feature.
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r--framework/Web/UI/WebControls/TBoundColumn.php23
-rw-r--r--framework/Web/UI/WebControls/TDataGrid.php1
-rw-r--r--framework/Web/UI/WebControls/TDataGridColumn.php11
-rw-r--r--framework/Web/UI/WebControls/TTemplateColumn.php16
4 files changed, 45 insertions, 6 deletions
diff --git a/framework/Web/UI/WebControls/TBoundColumn.php b/framework/Web/UI/WebControls/TBoundColumn.php
index 89de53bd..7927d198 100644
--- a/framework/Web/UI/WebControls/TBoundColumn.php
+++ b/framework/Web/UI/WebControls/TBoundColumn.php
@@ -35,6 +35,12 @@ Prado::using('System.Web.UI.WebControls.TDataGridColumn');
* The second method is possible because the textbox control created within the
* datagrid cell is the first child.
*
+ * Since v3.1.0, TBoundColumn has introduced two new properties {@link setItemRenderer ItemRenderer}
+ * and {@link setEditItemRenderer EditItemRenderer} which can be used to specify
+ * the layout of the datagrid cells in browsing and editing mode.
+ * A renderer refers to a control class that is to be instantiated as a control.
+ * For more details, see {@link TRepeater} and {@link TDataList}.
+ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Id$
* @package System.Web.UI.WebControls
@@ -56,6 +62,12 @@ class TBoundColumn extends TDataGridColumn
*
* If not empty, the class will be used to instantiate as a child control in the item cells of the column.
*
+ * If the class implements {@link IDataRenderer}, the <b>Data</b> property
+ * will be set as the data associated with the datagrid cell during databinding.
+ * The data can be either the whole data row or a field of the row if
+ * {@link getDataField DataField} is not empty. If {@link getDataFormatString DataFormatString}
+ * is not empty, the data will be formatted first before passing to the renderer.
+ *
* @param string the renderer class name in namespace format.
* @since 3.1.0
*/
@@ -78,6 +90,12 @@ class TBoundColumn extends TDataGridColumn
*
* If not empty, the class will be used to instantiate as a child control in the item cell that is in edit mode.
*
+ * If the class implements {@link IDataRenderer}, the <b>Data</b> property
+ * will be set as the data associated with the datagrid cell during databinding.
+ * The data can be either the whole data row or a field of the row if
+ * {@link getDataField DataField} is not empty. If {@link getDataFormatString DataFormatString}
+ * is not empty, the data will be formatted first before passing to the renderer.
+ *
* @param string the renderer class name in namespace format.
* @since 3.1.0
*/
@@ -211,10 +229,7 @@ class TBoundColumn extends TDataGridColumn
$value=$this->formatDataValue($formatString,$this->getDataFieldValue($data,$field));
else
$value=$this->formatDataValue($formatString,$data);
- if($sender instanceof IItemDataRenderer)
- $sender->setData($data);
- else if($sender instanceof IDataRenderer)
- $sender->setData($value);
+ $sender->setData($value);
}
}
diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php
index 65717d71..c10431da 100644
--- a/framework/Web/UI/WebControls/TDataGrid.php
+++ b/framework/Web/UI/WebControls/TDataGrid.php
@@ -56,6 +56,7 @@ Prado::using('System.Web.UI.WebControls.TPanel');
* - {@link TBoundColumn}, associated with a specific field in datasource and displays the corresponding data.
* - {@link TEditCommandColumn}, displaying edit/update/cancel command buttons
* - {@link TButtonColumn}, displaying generic command buttons that may be bound to specific field in datasource.
+ * - {@link TDropDownListColumn}, displaying a dropdown list when the item is in edit state
* - {@link THyperLinkColumn}, displaying a hyperlink that may be bound to specific field in datasource.
* - {@link TCheckBoxColumn}, displaying a checkbox that may be bound to specific field in datasource.
* - {@link TTemplateColumn}, displaying content based on templates.
diff --git a/framework/Web/UI/WebControls/TDataGridColumn.php b/framework/Web/UI/WebControls/TDataGridColumn.php
index 7228dcfd..161f24eb 100644
--- a/framework/Web/UI/WebControls/TDataGridColumn.php
+++ b/framework/Web/UI/WebControls/TDataGridColumn.php
@@ -27,6 +27,12 @@ Prado::using('System.Web.UI.WebControls.TDataGrid');
* The {@link getItemStyle ItemStyle} is applied to cells that belong to
* non-header and -footer datagrid items.
*
+ * Since v3.1.0, TDataGridColumn has introduced two new properties {@link setHeaderRenderer HeaderRenderer}
+ * and {@link setFooterRenderer FooterRenderer} which can be used to specify
+ * the layout of header and footer column cells.
+ * A renderer refers to a control class that is to be instantiated as a control.
+ * For more details, see {@link TRepeater} and {@link TDataList}.
+ *
* When the datagrid enables sorting, if the {@link setSortExpression SortExpression}
* is not empty, the header cell will display a button (linkbutton or imagebutton)
* that will bubble the sort command event to the datagrid.
@@ -34,6 +40,7 @@ Prado::using('System.Web.UI.WebControls.TDataGrid');
* The following datagrid column types are provided by the framework currently,
* - {@link TBoundColumn}, associated with a specific field in datasource and displays the corresponding data.
* - {@link TEditCommandColumn}, displaying edit/update/cancel command buttons
+ * - {@link TDropDownListColumn}, displaying a dropdown list when the item is in edit state
* - {@link TButtonColumn}, displaying generic command buttons that may be bound to specific field in datasource.
* - {@link THyperLinkColumn}, displaying a hyperlink that may be bound to specific field in datasource.
* - {@link TCheckBoxColumn}, displaying a checkbox that may be bound to specific field in datasource.
@@ -120,6 +127,8 @@ abstract class TDataGridColumn extends TApplicationComponent
* Sets the column header cell renderer class.
*
* If not empty, the class will be used to instantiate as a child control in the column header cell.
+ * If the class implements {@link IDataRenderer}, the <b>Data</b> property
+ * will be set as the {@link getFooterText FooterText}.
*
* @param string the renderer class name in namespace format.
* @since 3.1.0
@@ -172,6 +181,8 @@ abstract class TDataGridColumn extends TApplicationComponent
* Sets the column footer cell renderer class.
*
* If not empty, the class will be used to instantiate as a child control in the column footer cell.
+ * If the class implements {@link IDataRenderer}, the <b>Data</b> property
+ * will be set as the {@link getFooterText FooterText}.
*
* @param string the renderer class name in namespace format.
* @since 3.1.0
diff --git a/framework/Web/UI/WebControls/TTemplateColumn.php b/framework/Web/UI/WebControls/TTemplateColumn.php
index fe9674cc..bd3a2acb 100644
--- a/framework/Web/UI/WebControls/TTemplateColumn.php
+++ b/framework/Web/UI/WebControls/TTemplateColumn.php
@@ -24,8 +24,14 @@ Prado::using('System.Web.UI.WebControls.TDataGridColumn');
* and {@link setFooterTemplate FooterTemplate} to customize specific
* type of cells in the column.
*
- * Note, if {@link setHeaderTemplate HeaderTemplate} is not set, the column
- * header will be displayed with {@link setHeaderText HeaderText}.
+ * Since v3.1.0, TTemplateColumn has introduced two new properties {@link setItemRenderer ItemRenderer}
+ * and {@link setEditItemRenderer EditItemRenderer} which can be used to specify
+ * the layout of the datagrid cells in browsing and editing mode.
+ * A renderer refers to a control class that is to be instantiated as a control.
+ * For more details, see {@link TRepeater} and {@link TDataList}.
+ *
+ * When a renderer and a template are both defined for a type of item, the former
+ * takes precedence.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Id$
@@ -57,6 +63,9 @@ class TTemplateColumn extends TDataGridColumn
*
* If not empty, the class will be used to instantiate as a child control in the item cells of the column.
*
+ * If the class implements {@link IDataRenderer}, the <b>Data</b> property
+ * will be set as the row of the data associated with the datagrid item that this cell resides in.
+ *
* @param string the renderer class name in namespace format.
* @since 3.1.0
*/
@@ -79,6 +88,9 @@ class TTemplateColumn extends TDataGridColumn
*
* If not empty, the class will be used to instantiate as a child control in the item cell that is in edit mode.
*
+ * If the class implements {@link IDataRenderer}, the <b>Data</b> property
+ * will be set as the row of the data associated with the datagrid item that this cell resides in.
+ *
* @param string the renderer class name in namespace format.
* @since 3.1.0
*/