Source for file sortablelist.php
Documentation is available at sortablelist.php
* @package Joomla.Libraries
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* HTML utility class for creating a sortable table list
* @package Joomla.Libraries
* @var array Array containing information for loaded files
protected static $loaded =
array();
* Method to load the Sortable script and make table sortable
* @param string $tableId DOM id of the table
* @param string $formId DOM id of the form
* @param string $sortDir Sort direction
* @param string $saveOrderingUrl Save ordering url, ajax-load after an item dropped
* @param boolean $proceedSaveOrderButton Set whether a save order button is displayed
* @param boolean $nestedList Set whether the list is a nested list
public static function sortable($tableId, $formId, $sortDir =
'asc', $saveOrderingUrl, $proceedSaveOrderButton =
true, $nestedList =
false)
if (isset
(static::$loaded[__METHOD__
]))
JHtml::_('jquery.ui', array('core', 'sortable'));
JHtml::_('script', 'jui/sortablelist.js', false, true);
JHtml::_('stylesheet', 'jui/sortablelist.css', false, true, false);
// Attach sortable to document
JFactory::getDocument()->addScriptDeclaration("
$(document).ready(function (){
var sortableList = new $.JSortableList('#" .
$tableId .
" tbody','" .
$formId .
"','" .
$sortDir .
"' , '" .
$saveOrderingUrl .
"','','" .
$nestedList .
"');
if ($proceedSaveOrderButton)
static::_proceedSaveOrderButton();
static::$loaded[__METHOD__
] =
true;
* Method to inject script for enabled and disable Save order button
* when changing value of ordering input boxes
$(document).ready(function (){
var saveOrderButton = $('.saveorder');
saveOrderButton.css({'opacity':'0.2', 'cursor':'default'}).attr('onclick','return false;');
var oldOrderingValue = '';
$('.text-area-order').focus(function ()
oldOrderingValue = $(this).attr('value');
var newOrderingValue = $(this).attr('value');
if (oldOrderingValue != newOrderingValue)
saveOrderButton.css({'opacity':'1', 'cursor':'pointer'}).removeAttr('onclick')
Documentation generated on Tue, 19 Nov 2013 15:14:01 +0100 by phpDocumentor 1.4.3