JHTMLGrid/sort: Difference between revisions
From Joomla! Documentation
m →Examples: adding categories |
m preparing for archive only |
||
| Line 1: | Line 1: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[</nowiki>[[Description:JHTMLGrid/sort|Edit Descripton]]<nowiki>]</nowiki> | <nowiki>[</nowiki>[[Description:JHTMLGrid/sort|Edit Descripton]]<nowiki>]</nowiki> | ||
</span> | </span> | ||
===Syntax=== | ===Syntax=== | ||
| Line 66: | Line 65: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=sort | category=sort | ||
category=JHTMLGrid | category=JHTMLGrid | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 00:52, 25 March 2017
Syntax
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
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::_( 'Click to sort this column' ).'">';
$html .= JText::_( $title );
if ($order == $selected ) {
$html .= JHTML::_('image.administrator', $images[$index], '/images/', NULL, NULL);
}
$html .= '</a>';
return $html;
}
[Edit See Also] Template:SeeAlso:JHTMLGrid/sort
Examples
Code Examples