-
Notifications
You must be signed in to change notification settings - Fork 3
Table abstract
Ztal Table Abstract is the class from which all concrete tables should extend. It supports the Countable and Iterator interfaces.
The constructor. Override in a subclass to support passing of parameters at initialisation time.
Note that, like Zend_Form, the Abstract constructor calls out to _init so if you wish to set parameter values you should do it before calling parent::_construct
Override this method in concrete subclasses in order to setup the table as needed. Exactly the same concept as Zend_Form.
Append an instance of a Ztal\Table\Column\Abstract subclass to the table being defined.
Usually called within the _init method of the subclass but may be called from anywhere to append additional columns.
Returns an array providing an overview of the columns in the table. For each column an array entry is provided giving the column's key, whether it is sortable and, if so, the sort current direction:
<?php
array(
0 => array(
'key' => 'firstColumnKeyName',
'sortable' => true,
'sortDirection' => Ztal\Table\Column\Abstract::DIRECTION_ASCENDING,
),
1 => array(
'key' => 'secondColumnKeyName',
'sortable' => false,
'sortDirection' => 0,
),
);Returns the number of columns in the table.
This method should not be confused with the count method that provides the Countable Interface support for the class and which returns the number of rows in the table.
Provides support for the Countable Interface. Returns the number of rows in the table.
This method should not be confused with the columnCount method which returns the number of columns in the table.
Provides support for the Iterator Interface. Returns the internal Row class instance configured for the current row.
Note that (a reference to) the actual Row instance is returned so if the current row changes, the content of the returned class instance will also change.
Provides support for the Iterator Interface. Returns the index of the current row.
Provides support for the Iterator Interface. Moves the current index forward to the next row.
Provides support for the Iterator Interface. Resets the current row to 0.
Provides support for the Iterator Interface. Checks if the current offset (row) is valid. Will return false if iterating past the last row.
Return the current base uri value. This is the uri used in the table links for page and sort mode changing.
Set the base uri used by the table when generating the page and sort control links.
Return the html id attribute value used by the table. This value is set directly as the id of the
element on rendering and helps to differentiate between multiple tables on a page via css and javascript.Set the value to use for the id of the
Return the key name for the column the table is currently being sorted by or, if sorting is not available, null.
Sets the column with the supplied key name as the current sort column for the table.
Return the current table paginator instance or null if pagination is not setup.
Set the paginator instance to be used by the table.
Return the data source that provides the data to the table.
Set the data source used to provide the data for the table.
The first parameter (the actual data source) must either be an array or an object that supports both the Countable and Array Access interfaces. Throws an exception if the data source is not supported.
The second parameter is a flag that specifies whether the data source has already been sliced for pagination. If the data source is an object, pagination is configured and this flag is false (the default) then the data source is expected to support a slice method. See the (Ztal\Table\Paginator)[table-paginator] documentation for more details.
Please note that the data source is NOT cloned and MAY be modified (e.g. during pagination).