Sort order in editors

10 posts by 2 authors in: Forums > CMS Builder
Last Post: February 15, 2018   (RSS)

By leo - February 1, 2018

Hi rez,

If I get it right, the categories and menu items worked fine with dragSortOrder before, and not working after you modified one of the menu items? Can you provide an example (link or screenshot) of how they were before and after edit? I suspect the issue may be the loop so if you can attach the loop code that will be great.

I will wait for your response :)

Leo - PHP Programmer (in training)
interactivetools.com

By rez - February 2, 2018 - edited: February 5, 2018

Hi Leo. I'm horrible at being clear even though I write a book, sorry.

No, the web page is fine. It's the CMS editor thats not listing them the way I want. I'm not sure if i have ever displayed the CMSB editor list like this before, it would just be nice in long lists.

Cat editor:

https://www.screencast.com/t/2jmgEoTuiMp

Menu items editor:

https://www.screencast.com/t/HVJIeIFjSI

Web Page:

https://www.screencast.com/t/LlLgT10Ape

See how the menu items editor is not sorted like the categories or web page? Why is Steak Toppers listing out after Appetizers? When I have a very long list of menu items and they make changes, if the CMS was in the same order, it would be much easier to overhaul a menu with an email or print in front of me. Making everything in sync, going down the list and checking off updates. Follow me? The only sorting I see is clicking the "Category" header in the editor list but that doesn't sort as desired.

By leo - February 2, 2018

Hi rez,

Ah I see what you mean by "clicking the category to sort". So when you click the "category" column to sort the list items:

1. They are sorted by the value of that field. I suspect in this case the value of field "category" is the num of Category records, which means it's basically sorting by category num value

2. It's not actually "sorted". It does not change the item order in the database nor the default item order returned by getRecords().

However, dragSortOrder actually changes the item order. If you go to CMS Setup > Section Editors > [Menu Item Section], on top click "sorting" tab, you should see "dragSortOrder DESC" by default. This defines when getRecords() is called, the default order of items will be dragSortOrder descendent. And you can modify this value to change how the list should be ordered by default.

Let me know if you have any questions!

Leo - PHP Programmer (in training)
interactivetools.com

By rez - February 2, 2018 - edited: February 2, 2018

In the menu items editor, I have sorting set to dragSortOrder:

https://www.screencast.com/t/Ykz1pRA17ch

In the category list (I added record num to be viewable in the list), Soups are dragged to the second position (actually, they happen to be record 2 already).

https://www.screencast.com/t/7WKKFtbiqa

So in the CMS menu items records list (even after clicking the column / category sort header), "Soups" is still not displaying as the second category. Steak Toppers is the second category showing:

https://www.screencast.com/t/BDx3VpjP

I must be misunderstanding your explanation. Should soups be second in this case? Even if it was sorting by num (not what I want),  Soups should be  #2. I'm not feeling too bright here. :D  It's all good, the food menu is now updated but I want to understand and believe it will be easier next time if I could get it sorted the way I want.

For an admin, I want the records list in screenshot 3 above to be in the same order according to how I have them in screenshot 2 above (category dragSortOrder). This would list Soups second.

By leo - February 2, 2018

Hi rez,

You got exactly what I mean and you were right. The "Soup" category should definitely be the second. I have a clue what might cause the issue but could you provide a screenshot of the setting of menu items' category field?  You should be able to find it under Section Editors > Menu Items, click "modify" link beside the category field, and take a screenshot of "Field Options".

Also, what is the 3rd category after "steak toppers" in your menu items list page?

Leo - PHP Programmer (in training)
interactivetools.com

By rez - February 2, 2018

Requested screenshot:

https://www.screencast.com/t/FIg2jSBwU

The 3rd category list showing in the menu items list is "Sides".

Thanks!

By leo - February 5, 2018

Hi rez,

I suspect the problem is that the category field is sorting by its string value, "1x" will be after "1" instead of "2" because the first digit is 1 which is smaller than 2. The fast solution will be changing this field to INT type. Go to CMS Setup > Section Editors > Menu Items and modify to category field. Find the "MySQL Column Type" field under "Advanced Options". It should be Auto by default. Change it to be "INT" should solve your problem.

Let me know if this works!

Leo - PHP Programmer (in training)
interactivetools.com

By rez - February 5, 2018 - edited: February 5, 2018

That seems to put them in order by Category num and a weird number order (when toggling the "category" header in the menu items list editor) but I want them in the dragSortOrder of the category list, not num. Here is what that gives me when clicking the category header in the menu items list:

No arrow, default on page arrival:

  •   1 Appetizers
  • 10 Steak Toppers
  • 11 Sides
  •   2 Soups
  •   3 Steamer Pots
  •   4 Salads
  • 12 Sandwiches and Wraps
  •   7 Burgers and Chicken
  •   8 Entrees
  •   9 Butchers Block
  • ...and then one menu item of Burgers and Chicken at the bottom ?

 I assume the above is the INT order? I would like this to be the dragSortOrder of the Categories editor.

Arrow Up:

  •   1 Appetizers
  •   2 Soups
  •   3 Steamer Pots
  •   4 Salads
  •   7 Burgers and Chicken
  •   8 Entrees
  •   9 Butchers Block
  • 10 Steak Toppers
  • 11 Sides
  • 12 Sandwiches and Wraps

Arrow Down:

= opposite of arrow up

But I want:

Categories listed here in current drag order of category editor (already displaying on website correctly):

  •   1 Appetizers
  •   2 Soups
  •   3 Steamer Pots
  •   4 Salads
  •   8 Entrees
  •   9 Butchers Block
  • 10 Steak Toppers
  • 12 Sandwiches and Wraps
  •   7 Burgers and Chicken
  • 11 Sides

By rez - February 15, 2018

Unfortunately, still not working.