Skip to main content
Anthony.R
Participant
March 1, 2010
Question

Getting data from context into Popup (Cairngorm 3 + Parsley)

  • March 1, 2010
  • 1 reply
  • 4793 views

Hello,

I am having difficulty accessing a shared object form a PopUp that is part of a module.

In my module I have the following defined in my module's context.

<domain:CustomerDetail/>

In one PM I have the following...

[Inject]
[Bindable]
public var selectedCustomer:CustomerDetail;

This PM also sets the value of selectedCustomer;

The view for this PM also has a PopUp defined...

    <popup:PopUpWrapper open="{model.showCustomerDetailsDialog}"
                        opened="model.initDetailsPopup(event)"
                        closed="model.handlePopUpClosed(event)"
                        parent="{this}"
                        center="true" modal="true">
        <presentation:DetailsDialog/>
        <popup:behaviors>
            <popup:AddPopUpToParsleyContext context="{context}"/>
        </popup:behaviors>
    </popup:PopUpWrapper>

And in the PM for the PopUp I have...

        [Inject]
        [Bindable]
        public var customer:CustomerDetail;

When I look at this customer object in PopUp PM it is always null.  Another object that is defined in the parent shell applicaiton's context however is not null.  Th eonly way i can seem to set the customer object in the PopUp PM is to explicitly set it during the opening event in the PM that launches the PopUp.

Has anyone seen this behaviour?  Does anyone have a sample of using Popups with Cairngorm + Parsley and modules?

This topic has been closed for replies.

1 reply

Participant
March 8, 2010

Perhaps you forgott to Inject thie context?

[Inect]

[Bindable]

public var context::Context; //don't no the full classname, just use your AutoComplete to import it.

How do you know that  "public var selectedCustomer:CustomerDetail" isn't null? You also have to call the "ConfigureView" (parlsey 2.3) or "ConfigureIoc" Event on the component addedToStage event. If not called, the context won't be inected either.

I've made it to work and i can provide you an example later this day.

Anthony.R
Anthony.RAuthor
Participant
March 8, 2010

Thanks for your response.

I do have

[Inject]

[Bindable]

public var context::Context;

in the MXML where PopupWrapper is being used.

My issue seems to involve the use of modules.  I can use popups fine in my root application.  Any popups that appear in a module however are only able to access objects from the root context and not the child context it is in.  I've actually tried showing popups without PopupWrapper using the process described in the Parsley docs and get the same result.  This leads me to believe the issue is not with PopupWrapper but with Parsley instead.

Has anyone been able to successfully wire up a popup from a module using Cairngorm 3 and Parsley 2.2?  I'd love to see an example if you have.

Participant
March 8, 2010

Sry, haven't seen that you was talking about modules.

Why don't you post the full source of the mxml file on the parsley forum . The developer of parsley is always answering the threads.

Actually i can't see any reason, why not to pass the reference to the popup directly. Sure it's not so cool like an iject tag, but it would be also a dependecy injection. A setter injection if being precize.