What Mediator method to override when reloading viewstack component?
Support Staff2 Posted by Ondina D.F. on 11 Apr, 2012 10:56 AM
-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.