File tree 1 file changed +25
-0
lines changed
app/code/Magento/Ui/view/base/web/js/dynamic-rows 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -548,6 +548,13 @@ define([
548
548
} ) ;
549
549
550
550
this . labels . push ( data ) ;
551
+
552
+ /**
553
+ * Sort the array after an element was added to fix an bug where
554
+ * additional added field labels in ui_components haven't the right
555
+ * sort order.
556
+ */
557
+ this . labels . sort ( this . _compare ) ;
551
558
} , this ) ;
552
559
}
553
560
} ,
@@ -914,6 +921,24 @@ define([
914
921
} ) ) ;
915
922
} ,
916
923
924
+ /**
925
+ * Compare two objects by the sortOrder property.
926
+ *
927
+ * @param {Object } $object1
928
+ * @param {Object } $object2
929
+ * @returns {Number }
930
+ * @private
931
+ */
932
+ _compare : function ( $object1 , $object2 ) {
933
+ if ( $object1 . sortOrder > $object2 . sortOrder ) {
934
+ return 1 ;
935
+ } else if ( $object1 . sortOrder < $object2 . sortOrder ) {
936
+ return - 1 ;
937
+ }
938
+
939
+ return 0 ;
940
+ } ,
941
+
917
942
/**
918
943
* Set new data to dataSource,
919
944
* delete element
You can’t perform that action at this time.
0 commit comments