What Mediator method to override when reloading viewstack component?

pingale.indrajit's Avatar

pingale.indrajit

11 Apr, 2012 05:51 AM

Hi,

I have a Workflow.mxml with viewstack & WorkflowMediator.as mapped to each other.
In view stack there are 4-5 Canvases as NavigatorContent with there respective mediators.

Now, when viewstack loads any view the onRegister method of respective Canvas's mediator runs only once. When viewstack switch to already loaded Canvas then mediators OnRegister method is not running.

So problem I am facing is, how do I load new data/ Render component state inside Canvas in such case, or is there any method of Mediator I need to override to achieve this?

Regards,
Indrajit

  1. Support Staff 1 Posted by Ondina D.F. on 11 Apr, 2012 10:56 AM

    Ondina D.F.'s Avatar

    Hi Indrajit,

    -In the View’s mediator add an event listener for a custom event, say „viewsVisibilityChanged“ and a handler method onViewsVisibilityChanged (). Add an event listener for the FlexEvent.SHOW in your View.
    Within its handler method you can dispatch the custom event „viewsVisibilityChanged“ and the Mediator can ask for data within its onViewsVisibilityChanged (), for example it can dispatch an event to trigger a command that would either call a Service or access a Model’s method, depending on how you need to load the new data. In this case the Mediator should have registered an event listener for the event dispatched by the Service or Model, after the data has been loaded.

    -If the View containing the ViewStack would be mediated, it could dispatch an event when the selectedIndex changes, and the ViewStackMediator could redispatch this event to trigger a command to load the new data for the visible View.

    Does that answer your question?

    Cheers,
    Ondina

  2. 2 Posted by pingale.indraji... on 11 Apr, 2012 12:46 PM

    pingale.indrajit's Avatar

    Thanks for the prompt solution Ondina!

  3. 3 Posted by pingale.indraji... on 11 Apr, 2012 12:47 PM

    pingale.indrajit's Avatar

    Thanks for the solution Ondina!

  4. Support Staff 4 Posted by Ondina D.F. on 13 Apr, 2012 08:40 AM

    Ondina D.F.'s Avatar

    You're welcome, Indrajit!

  5. Ondina D.F. closed this discussion on 13 Apr, 2012 08:40 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac