Sort 'add to relation' dialogue by description
authorRichard Fairhurst <richard@systemeD.net>
Thu, 4 Oct 2012 23:12:54 +0000 (00:12 +0100)
committerRichard Fairhurst <richard@systemeD.net>
Thu, 4 Oct 2012 23:12:54 +0000 (00:12 +0100)
net/systemeD/potlatch2/RelationSelectPanel.mxml

index 00b0bd1..6aeede8 100644 (file)
           //relationSelector.dataProvider = relationList;
           for each (var id:Number in relationList) {
             var relation:Relation = conn.getRelation(id);
-            titles.push({label:id + ": " + relation.getDescription(), relId:id});
+            titles.push({label:relation.getDescription(), relId:id});
           }
+          titles.sortOn('label');
+          titles.forEach(function(item:Object, index:int, arr:Array):void { arr[index].label=item.relId+": "+item.label; });
           relationSelector.dataProvider = titles;
         }