[MAGNOLIA-4692] CLONE -MultiSelect does not keep the order of its value items (NodeDatas) Created: 28/Nov/12 Updated: 23/Jan/13 Resolved: 14/Dec/12 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | admininterface |
| Affects Version/s: | 4.4.6 |
| Fix Version/s: | 4.4.10 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Will Scheidegger | Assignee: | Jaroslav Simak |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | multiselect, nodedatacollection, order, sort | ||
| Remaining Estimate: | 1h | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | 1h | ||
| Issue Links: |
|
||||||||||||||||
| Template: |
|
||||||||||||||||
| Patch included: |
Yes
|
||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||||||||||
| Description |
|
If you use the multiSelect control in a dialog to select three nodes A, B and C, Magnolia will correctly save something like
But when you open the dialog the next time, chances are that the order will not be correct anymore. You save again and the order will now also be messed up in the repository. I don't know exactly why this is happening, but it boils down to Content.getNodeDataCollection() not returning the nodes in the "proper" order. However this is easily fixed: Simply sort the NodeDatas by name when retrieved from the Content object: ArrayList<NodeData> nodeDatas = new ArrayList<NodeData>(this.getStorageNode().getContent(this.getName()).getNodeDataCollection()); Collections.sort(nodeDatas, new Comparator() { }); The attached patch does exactly this. |