Class: atkTableRendererGrouped
Source Location: /utils/class.atktablerenderergrouped.inc
Class atkTableRendererGrouped
Class Overview
|
Renders table with row based groups. A grouped table is a table with some rows grouped together. They are visually folded and can be expanded by clicking.
This feature can be used to organise (long) tables where you only want to see a portion of logically grouped rows. By specifying which rows form a group the renderer can fold the rows so they are invisible. A group header row is displayed so, by clicking on it the visibility of the rows in the group is toggled. Please note that you can mix normal rows with grouped rows. See the data format example below. Use the following data format as the first argument to the render method. Format: $data = array(
array('headercol1', 'headercol2'), // header cannot be grouped, rendered as normal row
array('a1', 'b1'), // normal row
array('a2', 'b2'), // normal row
array(
'type' => 'group', // set this so the renderer knows it's a group
'id' => 'groupname1', // name of the group (unique), used as html id attribute
'collapsed' => true, // should the group be collapsed initially? optional, default is true
'header' => 'My Group', // the header row to display, use array format like a normal row or a string
'rows' => array( // the rows to be grouped together
array('a3', 'b3'),
array('a4', 'b4'),
array('a5', 'b5'),
)
array('a6', 'b6'), // normal row
),
array('footercol1', 'footercol2'), // cannot be grouped, normal row
)
Located in /utils/class.atktablerenderergrouped.inc [line 66]
Wiki documentation
atkTableRenderer
|
--atkTableRendererGrouped
Author(s):
Information Tags:
|
Properties
|
Methods
|
Method Summary
| int |
getAlignment() |
Overloading extension of parent::getAlignment() Adds special rule for groupheaders. |
| int |
_getMaxCols() |
Gets the maximum number of columns in a row. |
| bool |
_isCollapsedGroup() |
Checks if the group should be displayed collapsed or expanded |
| bool |
_isGroup() |
Determine if the data is a row group |
| string |
_renderBody() |
Renders the body of the table. The body contains all rows except the header and footer rows. Surrounds the body with tbody tags. |
Properties
Used in counting rows
API Tags:
Methods
Constructor
Parameters:
|
int |
$flags: |
flags to set on this object (see setFlag) |
|
string |
$style: |
stylesheet file (basename) to use like: 'recordlist'. |
|
string |
$module: |
module name to register style with |
API Tags:
int getAlignment(
string|int
$row, int
$col
)
|
|
Overloading extension of parent::getAlignment() Adds special rule for groupheaders.
Parameters:
|
string|int |
$row: |
rownumber or name |
|
int |
$col: |
column number |
API Tags:
| Return: | alignment flag |
| Access: | protected |
Redefinition of:
- atkTableRenderer::getAlignment()
- Gets the alignment for a specific cell
int _getMaxCols(
aray
$data
)
|
|
Gets the maximum number of columns in a row.
Parameters:
API Tags:
| Return: | max number of rows |
| Access: | protected |
Redefinition of:
- atkTableRenderer::_getMaxCols()
- Gets the maximum number of columns in a row
bool _isCollapsedGroup(
array
$group
)
|
|
Checks if the group should be displayed collapsed or expanded
Parameters:
API Tags:
| Return: | true if the group should be displayed collapsed, false otherwise |
bool _isGroup(
array
$entry
)
|
|
Determine if the data is a row group
Parameters:
API Tags:
| Return: | true if it is a group false otherwise |
| Access: | protected |
string _renderBody(
array
$data, [int
$rowOffset = 0]
)
|
|
Renders the body of the table. The body contains all rows except the header and footer rows. Surrounds the body with tbody tags.
Parameters:
|
array |
$data: |
all body rows |
|
int |
$rowOffset: |
how many header rows are drawn before the body |
API Tags:
| Return: | html table body |
| Access: | protected |
Redefinition of:
- atkTableRenderer::_renderBody()
- Renders the body of the table. The body contains all rows except the header and footer rows. Surrounds the body with tbody tags.
string _renderRowGroup(
array
$group, int
$rowOffset, int
$headerWidth
)
|
|
Renders a group of rows
Parameters:
|
array |
$group: |
data of the group |
|
int |
$rowOffset: |
how many real rows there were before |
|
int |
$headerWidth: |
number of columns the header has to span |
API Tags:
| Return: | html of the header and group |
| Access: | protected |
string _renderRowGroupHeader(
array
$group, int
$width
)
|
|
Renders the header of a group
Parameters:
|
array |
$group: |
group data to show header of |
|
int |
$width: |
span of the header cell |
API Tags:
| Return: | html of the header |
| Access: | protected |