PHP 클래스 Prado\Web\UI\WebControls\TDataGridColumn
TDataGridColumn serves as the base class for the different column types of
the {@link TDataGrid} control.
TDataGridColumn defines the properties and methods that are common among
all datagrid column types. In particular, it initializes header and footer
cells according to {@link setHeaderText HeaderText} and {@link getHeaderStyle HeaderStyle}
{@link setFooterText FooterText} and {@link getFooterStyle FooterStyle} properties.
If {@link setHeaderImageUrl HeaderImageUrl} is specified, the image
will be displayed instead in the header cell.
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}.
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 \Prado\IDataRenderer}
and obtain its {@link \Prado\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.
- {@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.
- {@link TTemplateColumn}, displaying content based on templates.
To create your own column class, simply override {@link initializeCell()} method,
which is the major logic for managing the data and presentation of cells in the column.
파일 보기
프로젝트 열기: pradosoft/prado
1 사용 예제들
공개 메소드들
보호된 메소드들
메소드 상세
The column allows sorting only when {@link getSortExpression SortExpression}
is not empty and the datagrid allows sorting.
getDataFieldValue()
보호된 메소드
If the data is an array, the field is used as an array key.
If the data is an of {@link TMap}, {@link TList} or their derived class,
the field is used as a key value.
If the data is a component, the field is used as the name of a property.
getEnableCellGrouping()
공개 메소드
public getItemStyle ( $createStyle = true ) : TTableItemStyle |
리턴 |
TTableItemStyle |
the style for item |
public getOwner ( ) : TDataGrid |
리턴 |
TDataGrid |
datagrid that owns this column |
getSortExpression()
공개 메소드
Returns a viewstate value.
protected getViewState ( $key, $defaultValue = null ) : mixed |
리턴 |
mixed |
the viewstate value corresponding to $key |
This method is invoked by {@link TDataGrid} when the column
is about to be used to initialize datagrid items.
Derived classes may override this method to do additional initialization.
The default implementation sets the content of header and footer cells.
If sorting is enabled by the grid and sort expression is specified in the column,
the header cell will show a link/image button. Otherwise, the header/footer cell
will only show static text/image.
This method can be overriden to provide customized intialization to column cells.
Loads persistent state values.
Saves persistent state values.
setEnableCellGrouping()
공개 메소드
By explicitly specifying the column ID, one can access the column
by $templateControl->ColumnID.
public setOwner ( TDataGrid $value ) |
$value |
TDataGrid |
|
setSortExpression()
공개 메소드
Make sure that the viewstate value must be serializable and unserializable.
protected setViewState ( $key, $value, $defaultValue = null ) |