1 Reply Latest reply on Feb 27, 2012 5:16 AM by Jakub Wojciechowski

    Reload viewstack child


      I am developing a flex application which has a master detail pages. The master page has a list of items in a datagrid and when the user clicks on an item the viewstack child is switched to display the details. I am also using a link bar to navigate back to the master view. However when the user clicks on a different item the child page does not get refreshed.

      What is the best way to reload the child view when the user clicks on a datagrid item?

        • 1. Re: Reload viewstack child
          Jakub Wojciechowski Level 1

          The easiest way is to have a bindable property in your detail View like:


          var user:UserType;

          and to bind all of your components to that user object, fe:


          <mx:Label id="userName" text="{user.name}" />



          And in your ViewStack:




                    <mx:DataGrid id="yourDataGrid" ... />


                <UserDetailView user="{yourDataGrid.selectedItem}"



          After changing the selection in your dataGrid, a new user object will be automatically binded to the view component.


          Of course you may consider a more complex solution with building a model layer containg selectedUser property, but the solution above should work ok.