PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: mico on March 12, 2010, 05:44:46



Title: Pass data from one View to another
Post by: mico on March 12, 2010, 05:44:46
Hello, forum!

There is a main display View with a ViewStack where ListView and DetailView is put. When user hits the item in ListView, ListViewMediator generates a notification that is handled by MainDisplayMediator and it changes the selectedIndex in the ViewStack. The question is how to pass a parameter from ListView (selectedItem) to the DetailViewMediator? What is the best way to do that?

I guess, I need to pass the selectedItem as a notification's argument but the problem is how to pass it further to the DetailViewMediator. Should it be the special Proxy for that?

EDIT:
I found something similar in CafeTownsend demo: there is also a list of employees and a detail screen. But there is a ViewStack with creationPolicy="all" there which simplifies things a lot. A mediator in detailviewmediator just listens to the notification that is generated when list item is changed. In my case I have no mediator at that very moment when List item is changed. So I need register a mediator for the detail when user goes to the details screen. And after that get the value from ListViewMediator.

Thanks a lot,
Mikhail