I tried to send some services to fetch data in the creationComplete handler. Then I need to process the server开发者_开发百科 raw data before displaying some sub-components. Where should I put this kind of code?
First off, I use Mate as my application framework. It definitely helps in situations like this.
When I've needed to do this kind of thing in the past I would make my service call in my creationComplete
handler and dispatch a custom event once all my data has been processed and distributed to my sub components' presentation models.
After the data was bound to all of my sub components I set their visibility to true or add them to the app, depending on what needed to happen.
You can already call services on the preinitialize method of your Application but it doesn't mean you will get your results before the creationComplete is dispatched.
If you want to display subcomponents after you get the results, I suggest you to have a look at Flex states. Or you can play with the visible property of you components. Sometimes it's enough to get what you need.
精彩评论