API16:JHtmlGrid/sort
From Joomla! Documentation
<! removed transcluded page call, red link never existed >
Syntax
static sort($title, $order, $direction= 'asc', $selected=0, $task=NULL)
| Parameter Name | Default Value | Description |
|---|---|---|
| $title | The link title | |
| $order | The order field for the column | |
| $direction | 'asc' | The current direction |
| $selected | 0 | The selected ordering |
| $task | NULL | An optional task override |
Defined in
libraries/joomla/html/html/grid.php
Importing
jimport( 'joomla.html.html.grid' );
Source Body
public static function sort($title, $order, $direction = 'asc', $selected = 0, $task=NULL)
{
$direction = strtolower($direction);
$images = array('sort_asc.png', 'sort_desc.png');
$index = intval($direction == 'desc');
$direction = ($direction == 'desc') ? 'asc' : 'desc';
$html = '<a href="javascript:tableOrdering(\''.$order.'\',\''.$direction.'\',\''.$task.'\');" title="'.JText::_('JCOMMON_CLICK_TO_SORT_THIS_COLUMN').'">';
$html .= JText::_($title);
if ($order == $selected) {
$html .= JHTML::_('image','system/'.$images[$index], '', NULL, true);
}
$html .= '</a>';
return $html;
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples