3 Replies Latest reply on Nov 30, 2010 10:36 AM by phil25840

    Communicating with a popup

    phil25840

      I have an MXML application that has a popup that contains a DataGrid. When the popup is loaded, I need to populate the grid from a datasource that exists in the applicaiton. Then I need to update the grid in the popup as events occur in the parent application. COuld somebody point me int he right direction to get this accomplished? THanks!

        • 1. Re: Communicating with a popup
          Lee Burrows Level 4

          set your datagrid dataProvider to your data source and make the data source bindable - then any changes to data source will automatically update the datagrid

          1 person found this helpful
          • 2. Re: Communicating with a popup
            flex2008 Level 3

            Define a property in the popup

             

            //assuming datasource in application is an arraycollection
            public function set dataSource(value:ArrayCollection):void
            {
                datagrid.dataProvider = value;
            }

             

            in main application,

             

            private function methodThatWillBeCalledWhenPopupNeedsToBeCreated():void
            {
                var popup:CustomPopup = PopupManager.createPopup(this,CustomPopup) as CustomPopup;
                popup.dataSource = this.dataSourceVarInApplication;
            }
            
            

            Another way is to bind the dataprovider of the grid to a model variable,which can be accessed anywhere in the application.

             

            Let me know if you have any questions

             

            Thanks

            • 3. Re: Communicating with a popup
              phil25840 Level 1

              Thanks!