3 Replies Latest reply on Sep 17, 2009 2:27 AM by lerooooogk

    Refresh a list when a mxml is opened


      Hi all,


      I have two mxml. In the first, i've a datagrid that is correctly populated and it has some headercolumns (for example: name).


      In the second mxml, I want to show the user all the names  in the datagrid.


      To show the names I use a list. That list is populated when the mxml creation is completed (event 'creationCompleted'). The problem is when the datagrid change so the new names are not shown to user.


      Is there any way, event or similar wich I can refresh the list when the second mxml is opened?


      Thanks in advance!

        • 1. Re: Refresh a list when a mxml is opened
          _Natasha_ Level 4



          This method called data binding


          See mx.binding.utils.BindingUtils for more info

          1 person found this helpful
          • 2. Re: Refresh a list when a mxml is opened
            flexprad09 Level 2

            Hi lerogke,


            You can use dataChange property of DAtagrid to call a function which should refresh dataprovider of your List.
            This is From what i can understand from your Post. But i am not sure  on which event you are opening your second MXML which contains list.
            I hope this helps.


            If this post answers your question or helps, please mark it as such.




            1 person found this helpful
            • 3. Re: Refresh a list when a mxml is opened
              lerooooogk Level 1

              Hi, thanks for your answers!


              DataBinding is very "hard" for my app because I really haved lot of mxml.


              I tried to use dataChange property but nothing happens.


              This is my actual code:


                    Datagrid in main.mxml

              <comp:ColoredDataGrid id="dg_events" width="100%" height="100%"
                                            <mx:DataGridColumn headerText="Nombre de evento" width="150"
                                            <mx:DataGridColumn headerText="ID" width="40"
                                            <mx:DataGridColumn headerText="Propietario" width="120"
                                            <mx:DataGridColumn headerText="Fecha" width="70"
                                            <mx:DataGridColumn headerText="Hora" width="55"
                                            <!-- <mx:DataGridColumn headerText="N. Parámetros" width="100"
                                                 dataField="numParams"/> -->
                                            <mx:DataGridColumn headerText="Parámetros"
                                            <!--<mx:DataGridColumn headerText="Archivo" width="40"


              And now filterParam.mxml (this is where I want to refresh the list). I paste a bit of code:


              <?xml version="1.0" encoding="utf-8"?>
              <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:comp="comp.*"
                        //Activamos panel de filtrado por parámetros y cargamos valores                    
                        public function load():void{
                             panel.percentHeight = 100;                              //Ajustamos tamaño
                             eventsArr = new Array();
                             eventsArr = eventList.categories_events();          //Obtenemos listado de eventos
                             eventsArr.push('---Todos---');                         //Añadimos etiqueta todos para el filtrador
                             eventsArr.sort(1);                                        //Organizamos alfabéticamente
                             owners = eventList.categories_owners();               //Obtenemos objetos propietarios
                             categories = eventList.categories_params();          //Obtenemos todos los parametros
                             matchFilter = new MatchFilter(dg);                    //Herramientas de filtrado
                                            <mx:List id="nameList" dataProvider="{eventsArr}" width="200" height="200"
                                                  doubleClick="nameEv = nameList.selectedItem.toString();"/>
                                            <mx:HBox width="100%">
                                                 <mx:Spacer width="100%"/>
                                                 <mx:Image source="@Embed('/assets/images/system/add.png')" click="addEvent()"
                                                               toolTip="Bla bla bla bla"/>     


              Thanks for your answers!