2 Replies Latest reply on Aug 20, 2007 6:10 AM by isleta13

    Passing parameters from datagrid to text

      I have a tabbed view of data inside a datagrid and when the user clicks on a record I want to show the rest of the record. With one dataProvider its simple:

      <mx:Text width="240" height="20" htmlText="{programs.selectedItem.name}"/>

      But how do you handle multiple dataProviders? When a different record from a different dataProvider is clicked I want it to show the new record in the panel to the right.

      So in the right panel I am trying something like:
      <mx:Text width="240" height="20" htmlText="{this.selectedItem.name}"/>
      <mx:Text width="240" height="20" htmlText="{data.this.name}"/>

      but no luck.

      Thanks for your help!
        • 1. Re: Passing parameters from datagrid to text
          ntsiii Level 3
          A list component can only have a single dataProvider and you can always access it using selectedItem:

          Perhaps you are using the wrong word when you say "dataProvider".

          What IS the dataProvider? What dataType?(ArrayCollection, XML,XMLListCollection?) How is it getting populated?

          • 2. Re: Passing parameters from datagrid to text
            isleta13 Level 1
            Thanks for the help. I have a 3 groups of data and they are all related. A program record could have a parent organization. I want the parent organization displayed as a link under the program and when you click on the parent org I want the action to take you to the org tab with the org record displayed. Is that possible? Something like:

            <mx:LinkButton label="{programRep.currentItem.parentname}" click="orgRep.selectedItem.name" />

            Here is my code:

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
            backgroundGradientColors="[0x333333, 0xDCDCDC]"

            <mx:HTTPService id="organizationRPC"
            url=" http://localhost:3000/organizations/list"
            useProxy="false" />

            <mx:HTTPService id="programRPC"
            url=" http://localhost:3000/programs/list"
            useProxy="false" />

            <mx:HTTPService id="eventRPC"
            url=" http://localhost:3000/bcevents/list"
            useProxy="false" />

            <mx:Panel x="246" y="67" width="780" height="600" layout="absolute" >

            <mx:TabNavigator id="tn" width="100%" height="100%">

            <mx:VBox label="Organizations">

            <mx:Accordion id="accordionOrgs" height="100%" width="100%" headerStyleName="aHeader">
            <mx:Repeater id="orgRep" dataProvider="{organizationRPC.lastResult.organizations.organization}">
            <mx:VBox height="100%" width="100%" label="{orgRep.currentItem.name}">
            <mx:Label color="black" text="{orgRep.currentItem.name}" />
            <mx:Label color="blue" text="Description" />
            <mx:Text width="100%" height="100%" htmlText="{orgRep.currentItem.description}"/>
            <mx:Label color="blue" text="Parent Organization" />
            <mx:Text width="100%" height="100%" htmlText="{orgRep.currentItem.parentname}"/>
            <mx:Label color="blue" text="Country" />
            <mx:Text width="200" height="25" htmlText="{orgRep.currentItem.country}"/>
            <mx:LinkButton label="{orgRep.currentItem.elink}" color="#0000FF" fontWeight="bold" />


            <mx:VBox label="Programs">

            <mx:Accordion id="accordionPrograms" height="100%" width="100%" headerStyleName="programHeader">
            <mx:Repeater id="programRep" dataProvider="{programRPC.lastResult.programs.program}">
            <mx:VBox height="100%" width="100%" label="{programRep.currentItem.name}">
            <mx:Label color="black" text="{programRep.currentItem.name}" />
            <mx:Label color="blue" text="Description" />
            <mx:Text width="100%" height="100%" htmlText="{programRep.currentItem.description}"/>
            <mx:Label color="blue" text="Parent Organization" />
            <mx:LinkButton label="{programRep.currentItem.parentname}" click="" />


            <mx:VBox label="Events">

            <mx:Accordion id="accordionEvents" height="100%" width="100%" headerStyleName="eventHeader">
            <mx:Repeater id="eventRep" dataProvider="{eventRPC.lastResult.bcevents.bcevent}">
            <mx:VBox height="100%" width="100%" label="{eventRep.currentItem.name}">
            <mx:Label color="blue" text="Description" />
            <mx:Text width="100%" height="100%" htmlText="{eventRep.currentItem.description}"/>
            <mx:Text width="100%" height="100%" htmlText="{eventRep.currentItem.startsat}"/>
            <mx:Label color="blue" text="Related Organization" />
            <mx:LinkButton label="{eventRep.currentItem.parentname}"/>
            <mx:Label color="blue" text="Related Program" />
            <mx:LinkButton label="{eventRep.currentItem.programname}"/>
            <mx:Label color="blue" text="Related Individual" />
            <mx:LinkButton label="{eventRep.currentItem.individualname}"/>