Manually sorting articles - ordering field

For Joomla! 4.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
neo314
Joomla! Apprentice
Joomla! Apprentice
Posts: 36
Joined: Sat Mar 13, 2010 4:22 am

Manually sorting articles - ordering field

Post by neo314 » Mon Feb 05, 2024 7:02 pm

Can anyone explain why there seems to be no "Rebuild" button to save a manual sorting of Articles? I was looking at it to get manual sorting working on my custom component project, and to my surprise, I find that there is not an automatic submit (which is understandable), but after resorting, there is no means to record the change in articles.

There is on the menu and in categories. I am surprised by google searches seem to come up empty on the subject.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44099
Joined: Sat Apr 05, 2008 9:58 pm

Re: Manually sorting articles - ordering field

Post by Webdongle » Mon Feb 05, 2024 9:10 pm

Which ordering field?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

neo314
Joomla! Apprentice
Joomla! Apprentice
Posts: 36
Joined: Sat Mar 13, 2010 4:22 am

Re: Manually sorting articles - ordering field

Post by neo314 » Mon Feb 05, 2024 10:17 pm

Manual ordering. Drag and drop to specify the order.

neo314
Joomla! Apprentice
Joomla! Apprentice
Posts: 36
Joined: Sat Mar 13, 2010 4:22 am

Re: Manually sorting articles - ordering field

Post by neo314 » Thu Feb 08, 2024 4:49 am

So I figured out rebuild has nothing to do with it and my efforts to reverse engineer had led me down the wrong path.

I figured out that the Ajax functions which I thought were not working, were in fact doing something.

saveOrderAjax in AdminController leads to AdminModel saveorder().

AdminModel saveorder() successfully reorders the articles (and the records in my custom component), but then, after properly updating the ordering column, AdminModel saveorder() executes the following:

Code: Select all

// Execute reorder for each category.
foreach ($conditions as $cond) {
    $this->table->load($cond[0]);
    $this->table->reorder($cond[1]);
}
Table->reorder puts everything back the way it was. I did an override of the saveorder method and commented out that code and it works fine. I'm not using categories on the table for which I wanted to implement reordering, but com_content uses categories, and when this code executes, you can see that $cond[1][1] ends up being `catid`=2 (uncategorized) so it is supposed to be doing something, but right now it just undoes the reordering.


Post Reply

Return to “Joomla! 4.x Coding”