Question about manual drag and drop ordering

66 views
Skip to first unread message

Steven Berkson

unread,
Feb 7, 2024, 7:42:49 PMFeb 7
to joomla-de...@googlegroups.com

Hi Folks,

 

I am still trying to implement drag and drop manual ordering. I just want simple, non-nested ability to manually sort a list.

 

I have gotten the drag and drop to work and the task to lead me to the task->controller-> model->rebuild() method, and in the limited examples I can see that seems to call the table class rebuild method which does not exist.

 

So it seems to me there is a built-in method that I cannot seem to find either in what I extend or in a use statement. I cannot seem to find an example or post that answers the question. The examples I have to work with are killing me. As noted in my earlier forum post (not this list), Articles does not seem to let you save the reordering. Neither does guided tours. Both category and menu are somewhat customized due to their role in the whole framework and both more complicated because of nesting, which I do not need.

 

Does anyone have an example or know of a post, or can otherwise guide me to getting a simple, non-nested, manual ordering of records using my singular, integer `ordering` database field?

 

I don’t want to write my own if I should be able to use something built in.

 

Steven

Steven Berkson

unread,
Feb 7, 2024, 11:14:16 PMFeb 7
to joomla-de...@googlegroups.com

So I have figured out that I have been on the wrong track, but it appears the issue I am having is the same issue that makes articles (com_content) not work.

 

Just dragging and dropping activates saveOrderAjax which then activates AdminModel saveOrder.

 

It goes through and correctly adjusts all the ordering values and then it executes the code:

 

// Execute reorder for each category.
foreach ($conditions as $cond) {
   
$this->table->load($cond[0]);
   
$this->table->reorder($cond[1]);
}

 

And that puts all the values back to where they were. WTF?

 

I’m not using categories for the list I am trying to sort, but com_content uses categories. Neither sorts with the drag and drop feature.

 

Any help would be appreciated.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/joomla-dev-general/SJ2PR22MB4167AA8E2DEE4163FDF98584CB442%40SJ2PR22MB4167.namprd22.prod.outlook.com.

Neo314

unread,
Feb 7, 2024, 11:30:05 PMFeb 7
to Joomla! General Development
P.S. I confirmed this by overriding the AdminModel saveorder() method and simply commenting out the foreach statement previously noted, and now it works fine.

Am I leaving something out, or is this broken? Given it seems to be a glitch with com_content, I'm leaning toward the latter.

René Kreijveld

unread,
Feb 28, 2024, 8:49:41 AMFeb 28
to Joomla! General Development
Do you need manual sorting for the frontend?

Op donderdag 8 februari 2024 om 05:30:05 UTC+1 schreef Neo314:

Steven Berkson

unread,
Feb 28, 2024, 12:15:05 PMFeb 28
to joomla-de...@googlegroups.com

In this case, yes. A list of options which have been entered in the correct order, but if I add one, it would probably need to be manually reordered.

 

I did this with J4.4, but I am using J5.0.3 now and I have not checked to see if the problem still exists. I am guessing it does.

René Kreijveld

unread,
Feb 29, 2024, 7:03:47 AMFeb 29
to Joomla! General Development
I have implemented frontend drag-and-drop ordering in a Joomla 5 custom component. This has only been tested in the Cassiopeia template.
If youy want I can workout samle code how te implement this.

Op woensdag 28 februari 2024 om 18:15:05 UTC+1 schreef Neo314:
Reply all
Reply to author
Forward
0 new messages