Spicefactory Forum Index Spicefactory
Forum Archive
 
 SearchSearch    Log inLog in 

Using MessageHandler in TabNavigator children

 
Post new topic   Reply to topic    Spicefactory Forum Index -> Spicefactory
View previous topic :: View next topic  
Author Message
diehl10



Joined: 08 Mar 2013
Posts: 1
Location: United States

PostPosted: Fri Mar 08, 2013 9:20 pm    Post subject: Using MessageHandler in TabNavigator children Reply with quote

I'm fairly new to using Parsley, and I am adding Parsley Messaging into an existing application. Our app has TabNavigators and ViewStacks with creationPolicy="auto", so that not all children are created on startup to save time.

We are using <RuntimeConfig> in the <ContextBuilder> and <Configure> tags in the views.

I'm able to use [MessageHandler] tags successfully in the child components of the view stack, as long as the child has been created. If the user hasn't already navigated to the view/tab, the message is not received. This makes sense to me, since the view is not added into the Context until it's been added to the stage.

I'm trying to pass data as a payload in the message, and have it be already present when the user navigates to the tab.

Are there any strategies to handle this type of situation? I would like to avoid changing the creationPolicy to "all" if at all possible. I'd also like to avoid storing the data in a data model if possible, since it would only be used in the model to solve this problem.

I've read through the documentation, but I'm still fairly new to using Parsley so I might be missing something obvious.
Back to top
View user's profile Send private message
rattkin



Joined: 10 May 2011
Posts: 154
Location: Poznan, PL

PostPosted: Sat Mar 09, 2013 10:13 pm    Post subject: Reply with quote

Quote:
I'd also like to avoid storing the data in a data model if possible, since it would only be used in the model to solve this problem.


This is sometimes a matter of perspective. Sometimes certain "ui control" values can also form a model of their own. You can even use the message you're sending as part of this model. Then, on view available, inject needed values or have them subscribed by decopled bindings. This way, you will have the data ready and get them for your view. Usually this is solved with help of presentation models. Adding views to context is a costly and usually unnecessary operation (it has to reflect on lots of view properties).

Alternatively you can simply wait for your view to be created and ready and added to context (creation complete or added to stage, not sure if Configure tag broadcasts similar event?) and only then dispatch your message.
_________________
Sebastian Zarzycki
Feerie Software
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Spicefactory Forum Index -> Spicefactory All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group