support GPX 1.1 too
[potlatch2.git] / net / systemeD / potlatch2 / BackgroundDialog.mxml
index cc81eb8205f69643d2d3cc3a734c4c1e1994256f..580a090ae8c4e550a0980d34679282531a88c5fb 100644 (file)
@@ -5,7 +5,7 @@
         horizontalAlign="center" 
         width="500" height="300" verticalGap="0">
 
-  <mx:DataGrid editable="true" width="100%" height="100%" id="dataGrid">
+  <mx:DataGrid editable="true" width="100%" height="100%" id="dataGrid" itemEditEnd="updateSource()">
     <mx:columns>
         <mx:DataGridColumn editable="true"  dataField="name" headerText="Name"/>
         <mx:DataGridColumn editable="true"  dataField="url" headerText="URL"/>
 
        public var dataCollection:ArrayCollection;
        private var menu:List;
+       private var collection:Object;
 
-    public function init(title:String, menu:List, source:Array):void {
+    public function init(title:String, menu:List, source:Object):void {
                this.title=title;
                this.menu=menu;
-               dataCollection=new ArrayCollection(source);
+               collection=source;
+               dataCollection=new ArrayCollection(source.collection);
         PopUpManager.addPopUp(this, Application(Application.application), true);
         PopUpManager.centerPopUp(this);
         this.addEventListener(CloseEvent.CLOSE, backgroundDialog_close);
@@ -72,6 +74,9 @@
        private function removeSource():void {
                dataCollection.removeItemAt(dataGrid.selectedIndex);
        }
+       public function updateSource():void {
+               collection.dispatchEvent(new Event("collection_changed"));
+       }
 
   ]]>
   </mx:Script>