?
avatar waader
waader
19 Oct 2019

Steps to reproduce the issue

In backend go for example in the articles list and set ordering to "Ordering descending". When you try to reorder an item you will see this javascript error in the console:

Uncaught TypeError: f.reverse is not a function

Generally trying to reorder items with "Ordering descending" is a problem at other places such as in the category list or the module list.

Expected result

Actual result

System information (as much as possible)

Additional comments

avatar waader waader - open - 19 Oct 2019
avatar joomla-cms-bot joomla-cms-bot - change - 19 Oct 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 19 Oct 2019
avatar Quy
Quy - comment - 26 Nov 2019

https://github.com/joomla/joomla-cms/blob/4.0-dev/build/media_source/system/js/draggable.es6.js#L59

TypeError: rows.reverse is not a function

      if (dir === 'desc') {
        // Reverse the array
        rows.reverse();
        inputRows.reverse();
      }

@C-Lodder

avatar C-Lodder
C-Lodder - comment - 26 Nov 2019

reverse() requires an array, so it's most likely that wrapper.querySelectorAll('[name="order[]"]') isn't returning anything.

Check the view: https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_content/tmpl/articles/default.php#L222

avatar brianteeman
brianteeman - comment - 7 Feb 2020

its not returning anything because there is nothing for it to return when there should be

avatar Quy
Quy - comment - 7 Feb 2020

When in descending order, ordering should be disabled. Check Categories.

avatar Quy
Quy - comment - 23 Apr 2020

It is returning a nodelist that reverse cannot be performed on. Sadly, I don't know JavaScript to provide a fix.

NodeList(3)
0: <input class="width-20 text-area-order hidden" type="text" name="order[]" size="5" value="2" data-order="2">​
1: <input class="width-20 text-area-order hidden" type="text" name="order[]" size="5" value="3" data-order="1">​
2: <input class="width-20 text-area-order hidden" type="text" name="order[]" size="5" value="1" data-order="3">
avatar C-Lodder
C-Lodder - comment - 23 Apr 2020

You need to convert the nodelist to an array

[].slice.call(document.querySelectorAll('[name="order[]"]'))

avatar Quy Quy - change - 23 Apr 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-04-23 23:17:01
Closed_By Quy
avatar Quy
Quy - comment - 23 Apr 2020

Please test PR #28773.

avatar Quy Quy - close - 23 Apr 2020

Add a Comment

Login with GitHub to post a comment