PDA

View Full Version : passing data from one card to another



gerartje
8 Jul 2010, 10:34 AM
Hello,

what's the best way to pass data to another card?

Assume I have a card with 3 dates and one detailCard.
Depending what I have clicked on the first screen I want to show different content.

Now I work like this:

I make a variable in my index.js, lets say "var selectedDay".
When I click a button, I set the variabele "selectedDay" and call "setCard(detailCard)"

DetailCard is an empty card (Panel component) with a listener added --> beforeactivate

When beforeactivate is fired, I call the correspondig handler with a "this.update(selectedDay)" call, to fill the content within the panel.

This works, but not always, sometime my panel is just empty. What am I doing wrong :-)

thanks

grtz

mrsunshine
8 Jul 2010, 2:02 PM
i would prefer to fire your own event in your application scope and include the information you need as params. than on your panel which should show the information, add a listener to you event and onYourEvent update the content of your panel.

gerartje
8 Jul 2010, 2:08 PM
seems logic :-)

I have done it the quick and dirty way now, time was against me :-)

tnx