Public Member Functions | |
| __construct () | |
| Construct a new AnewtGridRenderer instance. | |
| add_column ($column) | |
| Add a column to the grid. | |
| add_count_column ($header_text=null, $initial_value=null) | |
| Add a counter column to the grid. | |
| show_column ($column_id) | |
| Make sure a column is shown in the output. | |
| hide_column ($column_id) | |
| Make sure a column is hidden from the output. | |
| highlight_column ($column_id, $unhighlight_others=true) | |
| Mark a single column for highlighting. | |
| visible_columns () | |
| Return a list of columns that are visible using the current settings. | |
| add_row ($row) | |
| Add a row of data to the grid. | |
| add_rows ($rows) | |
| Convenience function to add a bunch of rows at once. | |
| set_rows ($rows) | |
| Set rows to the provided list. | |
| render () | |
| Render the grid into a valid XHTML snippet. | |
Private Member Functions | |
| _number_of_expanded_visible_columns () | |
| Calculate the total number of XHTML columns that will be used to render the output. | |
Static Private Member Functions | |
| static | _cmp_column_order ($col1, $col2) |
| Sort function that sorts AnewtGridColumns based on their 'order' property. | |
Private Attributes | |
| $_columns = array() | |
| List of columns. | |
| $_rows = array() | |
| List of data rows. | |
Some features:
These properties can be set to change the behaviour:
show-header: Whether to show a table header row (boolean, default: false)show-summary: Whether to show a summary line in the footer of the table (boolean, default: false)summary-text: Text on the summary lineclass Extra CSS class name for the table tag.generator: Optional AnewtGenerator instance for generating row class names. By default 'odd' and 'even' will be used. Definition at line 42 of file grid.lib.php.
| static AnewtGridRenderer::_cmp_column_order | ( | $ | col1, | |
| $ | col2 | |||
| ) | [static, private] |
Sort function that sorts AnewtGridColumns based on their 'order' property.
This method is used as a callback for usort()
| $col1 | AnewtGridColumn 1 | |
| $col2 | AnewtGridColumn 2 |
Definition at line 57 of file grid.lib.php.
| AnewtGridRenderer::add_column | ( | $ | column | ) |
Add a column to the grid.
If no custom AnewtGridCellRenderer instances were previously added to this column, a default AnewtGridCellRenderer is created and used, resulting in a single string cell, which is the common (simple) case.
| $column | A AnewtGridColumn instance. |
Definition at line 96 of file grid.lib.php.
| AnewtGridRenderer::add_count_column | ( | $ | header_text = null, |
|
| $ | initial_value = null | |||
| ) |
Add a counter column to the grid.
This is a convenience function that adds a column with id count and a AnewtCountGridCellRenderer with id count as the first column in the grid.
| $header_text | The header text to use (optional, defaults to empty string; leave null to use default) | |
| $initial_value | The initial value (optional, defaults to standard numbering; leave null to use default) |
Definition at line 132 of file grid.lib.php.
| AnewtGridRenderer::show_column | ( | $ | column_id | ) |
Make sure a column is shown in the output.
Column visibility defaults to true, but might have been disabled before.
| $column_id | The id of the column. |
Definition at line 154 of file grid.lib.php.
| AnewtGridRenderer::hide_column | ( | $ | column_id | ) |
Make sure a column is hidden from the output.
Hidden columns will not be rendered, so any expensive getter operations will not be executed (this is a considerable speedup in some cases).
| $column_id | The id of the column. |
Definition at line 169 of file grid.lib.php.
| AnewtGridRenderer::highlight_column | ( | $ | column_id, | |
| $ | unhighlight_others = true | |||
| ) |
Mark a single column for highlighting.
This method optionally disables the highlight property of all other columns.
| $column_id | The id of the column. | |
| $unhighlight_others |
Definition at line 185 of file grid.lib.php.
| AnewtGridRenderer::visible_columns | ( | ) |
Return a list of columns that are visible using the current settings.
Definition at line 210 of file grid.lib.php.
| AnewtGridRenderer::_number_of_expanded_visible_columns | ( | ) | [private] |
Calculate the total number of XHTML columns that will be used to render the output.
This depends on the number of cell renderers in each column.
Definition at line 236 of file grid.lib.php.
| AnewtGridRenderer::add_row | ( | $ | row | ) |
Add a row of data to the grid.
The data can be anything except null. However, if you want to use default renderers (those suffice for most simple cases), you should use an AnewtContainer object or an associative array for the $data parameter, since those can be rendered by the default AnewtGridCellRenderer using the id of the cell renderer as the property name of the object or as the key of the array.
| $row | Any value representing the row data (but not null). |
Definition at line 268 of file grid.lib.php.
| AnewtGridRenderer::add_rows | ( | $ | rows | ) |
Convenience function to add a bunch of rows at once.
| $rows | Array of row data |
Definition at line 283 of file grid.lib.php.
| AnewtGridRenderer::set_rows | ( | $ | rows | ) |
Set rows to the provided list.
This means all existing rows will be discarded. This method does not check the rows for null values (which are not allowed).
| $rows | Array of row data |
Definition at line 304 of file grid.lib.php.
| AnewtGridRenderer::render | ( | ) |
Render the grid into a valid XHTML snippet.
Reimplemented from AnewtRenderer.
Definition at line 319 of file grid.lib.php.
1.5.9