Joomla 3.10 subform: how to make it sortable?

57 views
Skip to first unread message

d...@yellowbell.net

unread,
Feb 14, 2023, 10:04:06 AM2/14/23
to Joomla! General Development
I've used a subform with repeatable fields for the first time is one of my components but I can't re-order the fields. The handles display OK, and the correct cursor is displayed when I mouseover them, but they're not draggable.

I suspect I need something equivalent to the "JHtml::_('sortablelist.sortable' ..." magic that I use with sortable tables but I can't find any examples, documentation, etc.

I know it works because the com_fields component uses this ... I just can't see how!

Any help would be great,

David

Mark Stanton

unread,
Feb 15, 2023, 5:57:23 AM2/15/23
to Joomla! General Development
I don't know if there's anything particular to subforms, and also I don't exactly remember how this works, but what I've got is setting the save URL with

    $saveOrderingUrl = 'index.php?option=com_mobilemanege&task=tests.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';

and setting up the list with

    HTMLHelper::_('draggablelist.draggable');

and presumably you've already got the body of the table properly class-ified with

class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="true"

?
Reply all
Reply to author
Forward
0 new messages