Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-4980

Multivalue field doesn't keep order when long list of elements

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Neutral Neutral
    • None
    • 6.0
    • None

      MultivalueField doesn't keep order of its elements when, according to test results, more than 128 elements.

      Steps to reproduce:

      1. Insert in multivalue field 128 elements
      2. Change order of the two first elements: it works
      3. Change order of the two last elements: it doesn't keep the order

      The cause of the error resides in info.magnolia.ui.form.field.MultiField class when calling switchItemProperties(Object, Object) method after changing the multivalue order. The comparison between identifiers is made with == operator which works fine with the first 127 elements but after that, objects compared are not the same (although they have same values) and therefore, condition is not true and the order is not changed:

      info.magnolia.ui.form.field.MultiField.switchItemProperties(Object, Object)
      ...
      if (propertyId == firstPropertyId) {
                              getValue().addItemProperty(firstPropertyId, propertySecond);
                          } else if (propertyId == secondPropertyId) {
                              getValue().addItemProperty(secondPropertyId, propertyFirst);
                          } else {
                              getValue().addItemProperty(propertyId, storedValues.getItemProperty(propertyId));
                          }
      ...
      

      Switching comparison operator to equals() should fix this issue.

        Acceptance criteria

              Unassigned Unassigned
              jayala Jonathan Ayala
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD