API15

Difference between revisions of "JHTMLGrid/sort"

From Joomla! Documentation

< API15:JHTMLGrid
(New page: <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </span> {{Description:JHTMLGrid/sort}} ===Sy...)
 
m (→‎Examples: adding categories)
Line 76: Line 76:
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API15]][[Category:Security mod error page]]

Revision as of 20:50, 12 May 2013

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

[Edit Descripton]

Template:Description:JHTMLGrid/sort

Syntax[edit]

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[edit]

libraries/joomla/html/html/grid.php

Importing[edit]

jimport( 'joomla.html.html.grid' );

Source Body[edit]

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[edit]

<CodeExamplesForm />