4 Replies Latest reply on Aug 21, 2007 1:42 PM by sean1000

    How to re-initialize the whole application?

    sean1000
      Hi Flexers,

      I've built a user portal type application in Flex. The user can log in then out out any number of times. I have some remaining problems with objects such as custom DataGridColumn renderers only correctly initializing the first time; when the user logs out then logs in again as a different user the renderers are still displaying data for the first login.

      Does anyone have any suggestions in general on how to handle this "login, logout, [need to reinitialize the whole app.], login" cycle?

      Thanks,
      Sean
        • 1. Re: How to re-initialize the whole application?
          Level 7
          "Does anyone have any suggestions in general on how to handle this
          "login, logout, [need to reinitialize the whole app.], login" cycle?"

          I had what I think is a similar situation. I have a text area pop up
          form that is repeatedly used in my application to add comments to
          multiple records. In my first attempt, the popup would contain the data
          entered in a previous record when accessed for a subsequent record.

          I resolved this by placing a "new MyCustomPopUp()" call in an
          appropriate place in my application. I would imagine a similar concept
          would work for you. Reinitialize the component(s) at an appropriate
          place in your login-logout logic flow.
          • 2. Re: How to re-initialize the whole application?
            ntsiii Level 3
            A quick and "dirty" solution to this is to use navigateToUrl to simply call the Flex apps html wrapper again. It ensures that EVERYTHING is initialized. Since the swf will be cached, performance should be ok, unless you have VERY heavy initial data loading.

            It feels kinda "hacky", but the choice is a lot of code to restore things to their initial condition.

            Tracy
            • 3. Re: How to re-initialize the whole application?
              levancho Level 3
              The way I have is following : securitymanager A/S class that handles user Login and Logout and fires App specific USER_LOGED_IN USER_LOGED_OUT events .then all components interested in those events regisiter their listeners with securityManager and when events fire they reset themselves accordingly.
              so for data grids etc All I have to to do is fetch or (re_fetch if needed ) date on login event and Clear it on log-out.
              • 4. Re: How to re-initialize the whole application?
                sean1000 Level 1
                Thanks to all the responders. For now I've gone with Tracy's option of reloading the base URL if the user wants to log in.