Renders data grids as XHTML in a fancy way.
Renders data grids as XHTML in a fancy way.
Some features:
AnewtContainer objects.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. __construct() ¶Construct a new AnewtGridRenderer instance.
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.
$columnA AnewtGridColumn instance.
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_textThe header text to use (optional, defaults to empty string; leave null to use default)
$initial_valueThe initial value (optional, defaults to standard numbering; leave null to use default)
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_idThe id of the column.
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_idThe id of the column.
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_idThe id of the column.
$unhighlight_others visible_columns() ¶Return a list of columns that are visible using the current settings.
A list of column objects.
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.
$rowAny value representing the row data (but not null).
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).
$rowsArray of row data
render() ¶Render the grid into a valid XHTML snippet.
XHTML string that can be used directly for output
static _cmp_column_order($col1, $col2) [private] [static] ¶Sort function that sorts AnewtGridColumns based on their 'order' property.
This method is used as a callback for usort()
$col1$col2An integer than can be used for usort()
_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.
A number indicating the number of visible columns.
AnewtContainer::_to_array()AnewtContainer::_add()AnewtContainer::delete()AnewtContainer::get()AnewtContainer::_isset()AnewtContainer::_seed()AnewtContainer::setdefault()AnewtContainer::getdefault()AnewtContainer::set()AnewtContainer::__isset()AnewtContainer::__set()AnewtContainer::__construct()AnewtContainer::is_set()AnewtContainer::add()AnewtContainer::_getdefault()AnewtContainer::__unset()AnewtContainer::seed()AnewtContainer::to_array()AnewtContainer::_get()AnewtContainer::__get()AnewtContainer::keys()AnewtContainer::clear()AnewtContainer::_keys()AnewtContainer::_set()