From 95f302ce4fbf3d923b52131495a77ef41b37e8c5 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 7 Sep 2007 13:34:10 +0000 Subject: Added support of TDataGrid to allow grouping consecutive cells with the same content. --- framework/Web/UI/WebControls/TDataGridColumn.php | 32 +++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'framework/Web/UI/WebControls/TDataGridColumn.php') diff --git a/framework/Web/UI/WebControls/TDataGridColumn.php b/framework/Web/UI/WebControls/TDataGridColumn.php index 161f24eb..73c374b0 100644 --- a/framework/Web/UI/WebControls/TDataGridColumn.php +++ b/framework/Web/UI/WebControls/TDataGridColumn.php @@ -27,15 +27,23 @@ Prado::using('System.Web.UI.WebControls.TDataGrid'); * The {@link getItemStyle ItemStyle} is applied to cells that belong to * non-header and -footer datagrid items. * + * 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. + * * 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. + * Since v3.1.1, TDataGridColumn has introduced {@link setEnableCellGrouping EnableCellGrouping}. + * If a column has this property set true, consecutive cells having the same content in this + * column will be grouped into one cell. + * Note, there are some limitations to cell grouping. We determine the cell content according to + * the cell's {@link TTableCell::getText Text} property. If the text is empty and the cell has + * some child controls, we will pick up the first control who implements {@link IDataRenderer} + * and obtain its {@link IDataRenderer::getData Data} property. * * 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. @@ -236,6 +244,24 @@ abstract class TDataGridColumn extends TApplicationComponent $this->setViewState('SortExpression',$value,''); } + /** + * @return boolean whether cells having the same content should be grouped together. Defaults to false. + * @since 3.1.1 + */ + public function getEnableCellGrouping() + { + return $this->getViewState('EnableCellGrouping',false); + } + + /** + * @param boolean whether cells having the same content should be grouped together. + * @since 3.1.1 + */ + public function setEnableCellGrouping($value) + { + $this->setViewState('EnableCellGrouping',TPropertyValue::ensureBoolean($value),false); + } + /** * @return boolean whether the column is visible. Defaults to true. */ -- cgit v1.2.3