Passing data to parent components

Howdy folks,
I'm basically attempting to pass data between components.
Passing data from a parent component to a child component is easy
enough but I have run into a few problems with attempting the
opposite.
Goal :-
In more detail, I have the parent component which contains an
accordian. Each accordian pane is a component within itself. The
first accordian pane is a search component that users can search
for a customer's site address and make a selection from a data
grid. When a user selects a customer from the grid, I wish to pass
the Site ID of that selection to the second accordian pane to
display that sites full details.
Problem :-
The way in which I have attempted to do this is by passing
the selection (the site ID) to a bindable variable (called SiteID)
in the parent component which contains the accordian (using
parent.SiteID = event.currentTarget.selectedItem.SiteID) to then
pass it to the second accordian pane where the site's details can
be displayed but I get an "Undefined property" error.
I believe a way to do this is by using a custom event for the
search component but I am hoping there is a more straight forward
way to do this.
Any help would be greatly appreciated.
Many thanks.

I think events are the best approach to your problem, you
could also use the
parent or
parentApplication properties to acces the parent component.
I think you can use Application.application and that one references
your parent application too.
I will insist that using events is the best solution, but
feel free to try the other solutions
Hope it helps u out

Similar Messages

  • Best method for passing data between nested components

    I have a fairly good sized Flex application (if it was
    stuffed all into one file--which it used to be--it would be about
    3-4k lines of code). I have since started breaking it up into
    components and abstracting logic to make it easier to write,
    manage, and develop.
    The biggest thing that I'm running into is figuring out a way
    to pass data between components. Now, I know how to write and use
    custom events, so that you dispatch events up the chain of
    components, but it seems like that only works one way (bottom-up).
    I also know how to make public variables/functions inside the
    component and then the caller can just assign that variable or call
    that function.
    Let's say that I have the following chain of components:
    Component A
    --Component B
    -- -- Component C
    -- -- -- Component D
    What is the best way to pass data between A and D (in both
    directions)?
    If I use an event to pass from D to A, it seems as though I
    have to write event code in each of the components and do the
    bubbling up manually. What I'm really stuck on though, is how to
    get data from A to D.
    I have a remote object in Component A that goes out and gets
    some data from the server, and most all of the other components all
    rely on whatever was returned -- so what is the best way to be able
    to "share" data between all components? I don't want to have to
    pass a variable through B and C just so that D can get it, but I
    also don't want to make D go and request the information itself. B
    and C might not need the data, so it seems stupid to have to make
    it be aware of it.
    Any ideas? I hope that my explanation is clear enough...
    Thanks.
    -Jake

    Peter (or anyone else)...
    To take this example to the next (albeit parallel) level, how
    would you go about creating a class that will let you just
    capture/dispatch local data changes? Following along my original
    example (Components A-D),let's say that we have this component
    architecture:
    Component A
    --Component B
    -- -- Component C
    -- -- -- Component D
    -- -- Component E
    -- -- Comonnent F
    How would we go about creating a dispatch scheme for getting
    data between Component C and E/F? Maybe in Component C the user
    picks a username from a combo box. That selection will drive some
    changes in Component E (like triggering a new screen to appear
    based on the user). There are no remote methods at play with this
    example, just a simple update of a username that's all contained
    within the Flex app.
    I tried mimicking the technique that we used for the
    RemoteObject methods, but things are a bit different this time
    around because we're not making a trip to the server. I just want
    to be able to register Component E to listen for an event that
    would indicate that some data has changed.
    Now, once again, I know that I can bubble that information up
    to A and then back down to E, but that's sloppy... There has to be
    a similar approach to broadcasting events across the entire
    application, right?
    Here's what I started to come up with so far:
    [Event(name="selectUsername", type="CustomEvent")]
    public class LocalData extends EventDispatcher
    private static var _self:LocalData;
    // Constructor
    public function LocalData() {
    // ?? does anything go here ??
    // Returns the singleton instance of this class.
    public static function getInstance():LocalData {
    if( _self == null ) {
    _self = new LocalData();
    return _self;
    // public method that can be called to dispatch the event.
    public static function selectUsername(userObj:Object):void {
    dispatchEvent(new CustomEvent(userObj, "selectUsername"));
    Then, in the component that wants to dispatch the event, we
    do this:
    LocalData.selectUsername([some object]);
    And in the component that wants to listen for the event:
    LocalData.getInstance().addEventListener("selectUsername",
    selectUsername_Result);
    public function selectUsername_Result(e:CustomEvent):void {
    // handle results here
    The problem with this is that when I go to compile it, it
    doesn't like my use of "dispatchEvent" inside that public static
    method. Tells me, "Call to possibly undefined method
    "dispatchEvent". Huh? Why would it be undefined?
    Does it make sense with where I'm going?
    Any help is greatly appreciated.
    Thanks!
    -Jacob

  • External Context Mapping - Pass data from Child to Parent

    Hello,
    I have the following scenario:
    DCParent Component (contains)
    - DCChildComp1    (used DC)
    - DCChildComp2    (used DC)
    - DCChildComp3    (used DC)
    - DCChildComp4    (used DC)
    What user enters in DCChildComp1 then needs to be made available to DCParent and all other DCChildComp(n) siblings.
    I have looked the posts and blogs in SDN and all of them seem to deal with passing inputField data from Parent to Child. May be I am missing it.
    In my case, I need the data to be passed from DCChildComp1 to DCParent ie Child to Parent. Then from DCParent to other DCChildComps.
    How should I go about
    a. defining the context nodes and Component Interface context nodes in parent vs child vs siblings and
    b. how should I map them externally?
    Step by step instruction would be helpful.
    Thanks in advance,
    SK.

    Thanks for all the help. As I had already seen all the links and blogs you had linked here, I was still confused about how it all came together. Finally, I got it after reading Bertram Ganz's response in this thread [Context Mapping problem;.
    when you map a context in the parent comp to an interface context in the used child component you do not define an external context mapping relation. That's normal context mapping as the data context resides in the child component.
    I have it working now and I am able to push the changes in the child component's context to the parent.
    For those who are interested in how I did it (and those who know a better way to do it
    In the child component DC:
    Map Child's View Context to Child's Controller Context
    Map Child's Controller Context to Child's Interface Controller (make sure the inputEnabled is FALSE - as the child is the data producer and the parent is the data consumer, in my case)
    In the parent DC:
    Add child DC as a Used DC
    Add child Component as a Used Component in the Parent Component
    Add Child's Interface Controller as Required Controller in Parent Component
    Map Child's Interface Controller Context to Parent's Controller Context
    Map Parent's Controller Context to Parent's View Context
    No external mapping required per the thread above. Now, any change in the child component's view is visible in the parent component view.
    Thanks again very much for the help.
    - Siva

  • How to  pass data between JDialog and its parent window ?

    Hi,
    I am new to swing. I want to know how pass data between a JDialog and its parent window.
    If you have any information please reply with example code.
    Thank You

    hi Encephalopathic ,
    I was looking for something like as it was given in the link provided by you.
    Thank you for reply It really helped me.

  • How to pass data between components?

    Hi everyone,
    How can I pass data between components? If possible, please
    give me sample code. Thanks.
    Note: I am using Flex 3.
    May

    There are lots of examples in the doc. You can start here:
    http://livedocs.adobe.com/flex/3/html/mxmlcomponents_advanced_1.html
    Stephen

  • What is the better way to pass input parameters between components?

    Hi all,
    I had a dispute with a colleague about passing data between different WDP Development Components. The situation is like this:
    Colleague has a SearchWDP (parent) und I have a BrowseWDP (child). After searching for some objects and clicking a hit in the SearchWDP, the corresponding details should be shown in BrowseWDP, via passing a bunch of parameters such as selected item's id, etc.
    Now which of the following is the better practice:
    - Defining a node in BrowseWDP (child) with isInputParameter set to TRUE, creating a similar node from the same type (simply via ModelBinding, both WDPs are using the same model) in SearchWDP, and defining a mapping between them so that SearchWDP fills the input nodes. From BrowserWDPs perspective, I'd call this Pull method.
    or...
    - Defining a node in BrowseWDP (child) with isInputParameter set to FALSE, creating a setter method in BrowseWDP Interface Controller for the collection (to be passed as parameters) and calling a wdContext.nodeBlaBla().bind(pInputParameterFromModelType). From BrowserWDPs perspective, I'd call this Push method.
    The colleague's argumentation in favor of Push has not convinced me at all and I'd like to ask your opinions. Is there a best practice or recommendation for this scenario? TIA
    ps: Any answer will be rewarded.

    Hi Cuneyt,
    Refer the links below, they are very informative!
    http://help.sap.com/saphelp_nw04s/helpdata/en/22/15a441cd47a209e10000000a155106/content.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/67/cc744176cb127de10000000a155106/content.htm
    These links are a part of the WebDynpro ABAP documentation, but the concepts are same for WDA and WDJ.
    Considering your scenario, I would recommend the first alternative you have mentioned (if you refer the second link its called External Context Mapping), where component controller context node of component A (SearchWDP) is the source for Interface controller context (same name) of component B (BrowseWDP).
    Thanks.
    Chitrali

  • How to pass data to a used DC.

    Hi,
    I have a Component which re-uses another component, how can I pass data to the used component?
    Do I need to create an event?
    Brayden.

    Hi Brayden,
    You don't need to create an event to pass data to a used component.  You can simply map the interface controller's context of the used component.  Just go to the properties tab of parent component and add the used components interface controller as a "required controller".  This will then allow you to map data between them.
    Best Regards,
    Austin

  • Passing data from one frame to another frame

    hello all, i am having a problem with passing data from one frame from another. I have a main frame when you click on connect button it display the second frame(class) that has 2 text fields and 2 buttons. When i click on connect it check if the data is correct. If the data is correct i want that frame to close and pass the data back to main frame. How can i do that.
    thank you

    hello all, i am having a problem with passing data
    from one frame from another. I have a main frame when
    you click on connect button it display the second
    frame(class) that has 2 text fields and 2 buttons.
    When i click on connect it check if the data is
    correct. If the data is correct i want that frame to
    close and pass the data back to main frame. How can
    i do that.
    thank you
    the original problem sounded like an ideal opportunity to use Modal Dialog. if you want one frame to display another to get user input then you need to stop the method in the main frame from executing until you recieve a valid input.
    you can use your own class and keep all of the components that you have in the connect frame but you would have to extend JDialog instead of JFrame.
    there is a way around it!
    if you must use JFrame for both, then you need to have access to the main frame in the connect frame, maybe pass the pointer to the constructor??
    anyway, when the connect frame is done with its duties, you have to use the pointer to call another method in the main frame that will continue the process. otherwise main frame doesn't know when connect frame is done and by that time, the method in main frame that instantiated the connect frame has long since died.
    also, it allows things to happen in the other window that you may not want to happen until the connect frame is done
    typically users of software start clicking around on things and you could have three or four connect frames going at the same time
    it's really best to use a Modal Dialog, it really can look just like a JFrame!!!!!!!!!!!!!!

  • Passing data from a container to another

    Hi,
    Let's say I have two containers (Container1=application , Container2).  Container1 gets some data from user, perform some database lookup and displays Container2 with the results from database lookup.
    Container1 --(call and display)--> Container2
    Below shows  how I am using a bindable variable in Container1 to pass the data from Container1 to Container2.  Also shows how I display Container2 from Container1.
    <!-- Container1 -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
       [Bindable] public var foo:String = "bar";
       private function loginHandler(event:LoginEvent):void
          mycontainer2 = new Container2();
          mycontainer2.name = "mycontainer2";
          this.addChild(mycontainer2);
    </mx:Application>
    I am accessing the data in Container2 as follow:
    <!-- Container2 -->
    {mx.core.Application.application.foo}
    Q1) Is there a better way to pass data from one container to another and access the data?
    Q2) Is this the only way to call and display Container2 from Container1?
    Q3) How can I move back to Container1 from Container2, i.e. Container2 call and display Container1
           Container2 --(back to)--> Container1

    Best practices call for using custom events to share data between components. Here is my Flex 3 Cookbook post on the topic:
    http://cookbooks.adobe.com/index.cfm?event=showdetails&postId=15466
    To switch easily between containers 1 & 2 use a ViewStack, the gold standard for such interaction, and manipulate the selectedIndex or selectedChild property:
    http://livedocs.adobe.com/flex/3/html/help.html?content=navigators_3.html
    If this post answered your question or helped, please mark it as such.

  • Passing data parameter between SWF files

    Hello Xcelsius Gurus,
    Is it possible to pass data parameter between SWF files?
    If possible, how to achieve it?
    Thank you.
    Justine

    Hi,
    Thank you for the reference.  Little bit confused, please let me clarify. 
    I do not understand how the receiver SWF receieved the data parameter and process.
    For example, I have a parent dashboard and a child dashboard.  In the parent dashboard, I have set up combo box to filter the data.  And I want the data that I have selected in combo box to the child dashboard.
    To do this, first I need to setup the flash variable at the parent dashboard to fetch the data I selected.
    After this, how to link this data to the child dashboard?
    Furthermore, after the child dashboard received the data parameter, I need this data to insert into the spreadsheet so I can filter the data.  Is this possible?
    Thanks.
    Edited by: Justine Liu on Jan 19, 2010 3:11 PM

  • How to pass data between views using Flex for mobile?

    Hi,
      In my 1st view, I have set of images. Each image represents a product category. When I click on an image, it has to show my 2nd view which is a list. This should show all the products linked to this category.
    I saw few examples where the 1st view is a list. Select an item in a list shows the details in the next view.
    But what I need is, I need to know which image is clicked in my 1st view (ie) Home page. This id needs to be passed to my 2nd view to retrieve the data for the clicked image (clicked product category).
    Can anyone help me in this?

    Chellaa2011,
      If I understand you correctly, you can pass data to the next view by passing the second parameter to the pushView method. 
      check out: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/ViewNa vigator.html#pushView()
      I've written similar apps in the past and found that a singleton class alleviates some of these issues.  If you use a singleton to track currently selections all your views can access the same data without having to pass and return data from each other.
    Hope this helps,
    KLee

  • Passing data to a separate jpf

    What is the best practice for passing data from one jpf to another? I have a collection of jpf's generated from rowset controls. And, I would like some of them to restrict their query only to the parent row as selected in a previous screen. What is the bestway to minimize maintenance and rework to store this key, and use it in the receiving jpf rowset control? Should I simply save it in global, and modify the sql in the receiving jpf's associated rowset control?

    Thanks. Unfortunately when I try to follow the url you provided it dumps me in the help files:
    http://e-docs.bea.com/workshop/docs81/doc/en/core/index.html
    And, when I try to enter the url explicitly, I get an error saying I do not have sufficient authority to access it. I get this at the samplesrc directory.

  • Passing Data From One Component To The Node Of An Other Component

    Hi Experts,
        I have a component A (parent) in which i am usuing an other component B (child) . From the parent component i am able to pass data to the child component by using one of the child's interface node but when i try to use one of the parents interface nodes to pass data from the child to the parent component i am unable to pass data as required .
        Please tell me where i am going wrong.
    Thanks In Advance,
    Chaitanya.

    In Component B, check the property of the Interface node Input Element( Ext.) tick it.
    Now, bind the node like the one we do in ALV
    Abhi

  • How to pass data from one  UIBB to anothere UIBB in OIF/GAF - FPM

    Dear all,
    as of now i am using FPM only for displaying data  from different components.
    now i would like to pass the data from one UIBB to another by calling second UIBB on action of a button. (instead of using standard path in GAF scenario)
    how could i achieve this.  is there any difference mechanism's for UIBB's of single component and UIBB's from different different components.
    it would be great if some one can explain or help me reg this issue on both OIF and GAF FPM's.
    Thanks in Advance.
    Best Regards,
    Kranthi kumar Palle.

    I've actually combined these two approaches to data sharing - I've passed a class reference in the shared data component. This is nice (in my opinion) because it is very obvious where the data is coming from and who it is shared with. It also means that there is not a huge overhead in passing data through the shared context, because you are just replicating a reference to a class instance.
    And -  you don't have to deal with singleton classes :-). So if you want/need to extend your implementation at a later date (for example embedding multiple instances of the same "app" in the one window - or suspending and resuming to another instance of the same app you can then do this. (NB - suspend resume to launch another FPM app does not work because of this (amongst other things)).
    NB a shared data component need not be faceless! I certainly have "shared data" UIBBs that also have UI components - possibly not best practice - but it certainly can be done.
    Cheers,
    Chris

  • Bidirectional binding and passing data.

    I started learning Flex and I have couple of problem of which I can't see a clear solution.
    Flex 4 has two way binding, but how can I use it with data type different from strings? I receive from a web service dates and numbers, let the user edit them and send them back to the web service. Flex 4 code generator created all the necessary objects, that contain numers and dates types. Presenting them to the user in text fields (or date fields) is easy, but I can't get such a simple way to send them back. When I try two way binding it gives compilation error because it think I'm trying to force a cast from String to Number or Date. If I understand correctly, the only way to get the data back to the web service is:
    Introduce validators for Numbers and Dates
    For each of the form element, check if it is valid
    If all of them are valid, convert them manually to the appropriate type
    Populate back the original object with new values (and then send it to the web service)
    Is there a smarter way to let the two way binding work the way is meant to be? Is there some way to set the converter to use when binding back from String to Number?
    By the way, is there some simple way to ask a Form object that all the contained fields are valid?
    The second problem regards passing data among different views: is there a standard way in Flex to "share" data between different mxml files? I have two scenarios:
    A view (mxml file) uses a lot of components (other mxml files, that may include other components as well). There are a few objects, mostly data container, that I'd like to use in most of this hierarchy. Which is the best way to share these objects? Do I have to set something static in the root view and have all the other components access them statically? Or do I have to write setters in all the components in the hierarchy and pass all the objects down the hierarchy? Is there a quick way to set up a sort of "session" for this hierarchy and access it?
    A view (mxml file) presents a list of results. Selecting/clicking on one of the results the user goes to another view (mxml file, may be a module), but in the new view I need a reference to the data the user selected in the previous view. The first solution here seems to be using an event and passing the data with it, but is there any other way? I'm looking for something that can cover both this and the previous case.
    Any suggestion is welcome. Sorry if the question was already posted but I didn't find any clear answer.

    This works as expected for me: I see the text "invalid" any time a change occurs to the text in the text field that causes the value of the DoubleProperty to change.
    E.g.:
    Select the default value (42.0); press a non-numeric key to change the text. The invalidation listener is invoked.
    Delete the text. The invalidation listener is not invoked (the text is now "", which causes a NumberFormatException, the double property is "set" to zero, which is no change so there is no notification).
    Enter 0. There is no notification (the value of the DoubleProperty has not changed).
    Enter a non-zero numeric value. The invalidation listener is notified.
    Change to zero. The invalidation listener is notified
    Change to non-numeric text. The invalidation listener is not notified (the value of the DoubleProperty has not changed).
    If you're expecting the text to update to zero when non-numeric text is input: I guess the implementation is something like
    if (! converter.fromString(text).equals(value)) {
         // updateText
    in the binding's method that listens for changes in the DoubleProperty. This is similar to not seeing "1.0" appear in the text field when you type "1"; or "123.0" appearing when you type "0123", etc.

Maybe you are looking for

  • Couldn't parse image from XML file using NSXMLParser

    Hi all, Since i am newbie to developing iPhone application, i have problem in parsing XML data. I use the following code for parsing XML file, this is RootViewController.h file #import <UIKit/UIKit.h> #import "SlideMenuView.h" #define kNameValueTag 1

  • Help w/ Reinstalling Windows XP from Recovery Disk No. DVD Kit 361935-001

    Re: HP Operating System DVD - Windows XP Pro. SP2 - HP or Compaq PC. No. DVD Kit 361935-001 Can I reinstall Windows XP on an HP computer using the COA received with the computer?  I read the following online and not sure what it means: "It may not wo

  • SQL Statement / index on function ??

    Hello My environment is : Oracle 9.2.0.7 In "top sql sessions" I obtained that sql statement as below consumes many ressources. When I use "SQL Analyzer" ... no recommandation was specified but I wonder if an index on function may be use to optimize

  • Apple ID iCloud address showing green rather than blue.

    I just helped a friend obtain an Apple ID. Subsequently, their new icloud address only shows as green in Messages on my iPhone. From my Mac it shows as Blue as it should be. I am puzzled as what to suggest.

  • Help finding files

    I have 4 different hard drives and have very poor organization skills. all hard drives have been used as my scratch disk at one time or another. I lost a *.fcp file and can't find it.I don't remember what I named it. I do know that in the browser I h