Revolution: Menuindex values messed up when duplicating a folder

Created on 16 Jul 2020  路  1Comment  路  Source: modxcms/revolution

Feature Request

Summary

Duplicating an existing folder causes a lot of problems with sorting in the new folder. I had to create a script to redo all the menuindex values inside a folder to fix this problem

Step to reproduce

In general, I want to NOT duplicate menuindexes when duplicating a resource. That makes sorting work properly, since I don't have to deal with duplicate menuindexes. However, when I duplicate a folder that has children, and I want the new folder to NOT duplicate the menuindex of the original, I want the children of the new folder to retain the original menuindexes so that they are sorted properly.

Observed behavior

With the system setting "preserve_menuindex" turned off, after duplicating a folder, the new folder has a new menuindex, which is what I want, but ALL the children of the new folder will have the same menuindex as each other (the value of the largest menuindex of the children in the original folder). Since all the menuindex values of the children are now the same, the order can be completely different from the original folder, since sorting by menuindex doesn't do what's expected. If there are any folders inside the original folder, all those children will also have the same index as each other rather than retain the original menuindex values.

Desired behavior

It would be great to have an option to ratain menuindexes on children when duplicating a folder, independent of the system setting "preserve_menuindex". This could be accomplished one of two ways:

  1. Have a separate system setting concerning children ("preserve_menuindex_children" for example).
    OR
  2. Have an option in the popup menu for duplicating so that there is a checkbox for both "duplicate children" and "retain menuindex of children".

Environment

All versions of MODX

bug

Most helpful comment

If you duplicate a resource with children it doesn't make sense to re-order the children, even if you don't preserve the menu index of the parent. In my opinion we need to keep the menu index of the original, or at least recalculate the menu index of the children but in the same order as the original.

>All comments

If you duplicate a resource with children it doesn't make sense to re-order the children, even if you don't preserve the menu index of the parent. In my opinion we need to keep the menu index of the original, or at least recalculate the menu index of the children but in the same order as the original.

Was this page helpful?
0 / 5 - 0 ratings