SwatObject
└─SwatUIObject
└─SwatCellRendererContainer
└─SwatTableViewColumn
└─SwatTableViewOrderableColumn
public class SwatTableViewOrderableColumn
extends SwatTableViewColumn
| Field Summary | |
|---|---|
| final mixed | Indicates ascending ordering is done. |
| final mixed | Indicates descending ordering is done. |
| final mixed | Indicates no ordering is done. |
| string | The base of the link used when building column header links. |
| array | HTTP GET variables to remove from the column header link. |
| Fields inherited from Swat.SwatTableViewColumn | |
|---|---|
| abbreviated_title, has_auto_id, id, input_cell, title, view, visible | |
| Fields inherited from Swat.SwatCellRendererContainer | |
|---|---|
| renderers | |
| Fields inherited from Swat.SwatUIObject | |
|---|---|
| classes, html_head_entry_set, parent, visible | |
| Method Summary | |
|---|---|
| void | Displays the column header for this table view column. |
| protected array | Gets the base CSS class names of this orderable table-view column. |
| string | getDirectionAsString(integer direction_id) Gets the direction of ordering as a string. |
| private string | getLink() Gets the link for this column's header. |
| private integer | Gets the next direction or ordering in the rotation. |
| void | init() Initializes this column. |
| private void | Process GET variables and set class variables. |
| void | setDirection(mixed direction, $direction integer, $set_as_orderby_column boolean) Sets the direction of ordering. |
| private void | setDirectionByString(string direction) Sets direction of ordering by a string. |
| Methods inherited from Swat.SwatTableViewColumn | |
|---|---|
| addChild, copy, display, displayHeader, displayHeaderCell, displayRenderers, displayRenderersInternal, getBaseCSSClassNames, getCSSClassNames, getDescendants, getFirstDescendant, getHtmlHeadEntrySet, getInlineJavaScript, getInputCell, getMessages, getTdAttributes, getThAttributes, getTrAttributes, getXhtmlColspan, hasHeader, hasMessage, init, process, setInputCell, setupRenderers | |
| Methods inherited from Swat.SwatCellRendererContainer | |
|---|---|
| addChild, addMappingToRenderer, addRenderer, copy, getDescendantStates, getDescendants, getFirstDescendant, getFirstRenderer, getHtmlHeadEntrySet, getRenderer, getRendererByPosition, getRendererInlineJavaScript, getRenderers, setDescendantStates | |
| Methods inherited from Swat.SwatUIObject | |
|---|---|
| addComment, addJavaScript, addStyleSheet, addTangoAttribution, copy, getCSSClassNames, getCSSClassString, getFirstAncestor, getHtmlHeadEntrySet, getInlineJavaScript, getUniqueId, isVisible | |
public final mixed ORDER_BY_DIR_ASCENDING = 2
Indicates ascending ordering is done
public final mixed ORDER_BY_DIR_DESCENDING = 1
Indicates descending ordering is done
public final mixed $ORDER_BY_DIR_NONE
Indicates no ordering is done
public string $link = ''
The base of the link used when building column header links
Additional GET variables are appended to this link in the getLink() method.
public array $unset_get_vars = array()
HTTP GET variables to remove from the column header link
An array of GET variable names to unset before building new links.
public void displayHeader()
Displays the column header for this table view column
This method displays an appropriate header based on the current direction of ordering of this table view column. If the column has been ordered, an image indicating the ordering is also displayed in the header.
protected array getBaseCSSClassNames()
Gets the base CSS class names of this orderable table-view column
public string getDirectionAsString(integer direction_id)
Gets the direction of ordering as a string
Retrieves the current ordering direction of this column or an arbitrary direction constant as a string. The string is returned the lowercase abbreviated form 'asc' or 'desc'.
direction_id - an optional direction constant to convert to a string rather than using this column's current direction.private string getLink()
Gets the link for this column's header
This method builds the link by appending special GET variables and unsetting other ones.
private integer getNextDirection()
Gets the next direction or ordering in the rotation
As a user clicks on the comun headers the direction of ordering changes from NONE => ASCSENDING => DESCENDING => NONE in a loop.
public void init()
Initializes this column
The current direction of ordering is grabbed from GET variables.
private void initFromGetVariables()
Process GET variables and set class variables
public void setDirection(mixed direction, $direction integer, $set_as_orderby_column boolean)
Sets the direction of ordering
This method sets the direction of ordering of the column, either asc, desc, or none.
integer - One of the ORDER_BY_DIR_* class contantsboolean - Whether to set this column as the column currently used for ordering of the viewprivate void setDirectionByString(string direction)
Sets direction of ordering by a string
Sets the current ordering direction of this column.
direction - ordering direction as a string. The direction is case insensitive and may be the short form 'asc' or 'desc' or the long form 'ascending' or 'descending'.
An orderable table view column.
This column has a clickable header that allows the user to change the ordering of the column. This behaviour is commonly used for databound table columns.
TODO: Implement this functionality with AJAX.