64 $this->reorderHandler = $handler;
69 $this->reorderHandler = $handler;
74 if (!count($this->items))
return;
75 $pk = $this->items[0]->getPrimaryKey();
77 $script = <<<ENDSCRIPT
78 <script type=
'text/javascript'>
79 window.addEvent(
'domready',
function()
81 new DraggableList(
'{$this->id}',
'{$this->reorderHandler}',
'{$pk}');
90 if (!count($this->items))
92 echo
"<p>{$this->emptyList}</p>";
99 $attrs .=
" class='draggable {$this->CSSclass}'";
103 $attrs .=
" class='draggable'";
106 if ($this->styles) $attrs .=
" style='{$this->styles}'";
110 <<?echo $this->listTag?>
id=
"<?echo $this->id?>"<?echo $attrs?>>
112 foreach($this->items as $item)
114 $pkTag =
" data-pk='".$item->getPrimaryKeyValue().
"'";
118 if (is_callable($this->format))
120 echo call_user_func($this->format, $item);
122 else echo $item->format($this->format);
126 echo
"</{$this->listTag}>\n";
DraggableList provides a simple user interface for sorting a list of items.
__construct($items, $id="draggable_list", $format=null, $handler=null)
enableDragReorder($handler)
$CSSclass
CSS class(es) to be applied to the list.
$listTag
The HTML list tag type.
$dragText
Optional text to display above reorderable table.
$emptyList
Message to display when the list is empty.
$styles
Specific CSS styles to be applied to the list.
$reorderHandler
Handler script that implements reordering records.