Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
-
Eclipse on Windows
Description
Hello,
We are working with picklists and recently discovered that the order of the selected elements will be placed inverted into the new picklist with the move method. Reason for that is the decremental for loop, which in fact is the correct start to the problem of transferring the elements but will therefore put the elements in the wrong order when putting them to the end of the new picklist. Following patch helps solving this problem:
@@ -72,11 +72,11 @@
return;
}
+ var tLen = toList.options.length;
// Decremental loop, so the index is not affected in the moves
for (var i = fromList.options.length - 1; i >= 0; i--) {
if (fromList.options[i].selected)
@@ -85,10 +85,10 @@
org.apache.myfaces.Picklist.moveAll = function (fromList, toList, hiddenId) {
+ var tLen = toList.options.length;
// Decremental loop, so the index is not affected in the moves
for (var i = fromList.options.length - 1; i >= 0; i--)