I can’t believe I am actually answering a question here. 

 

What does department.xml look like?  If your XML is like this for example:

 

<dashboard>

      <menu>

            <button label="Help"/>

            <dropDowns>

                  <dropDown label="Site Location:">

                        <item label="AFDW"/>

 

You should be able to just add the next node name after the currentItem, like this:

 

        <mx:Repeater id=”r2” dataProvider="{dataService.result.dashboard.menu.dropDowns.dropDown}" startingIndex="0">

                  <mx:Text text="{r2.currentItem.label}" textAlign="right"/>

 

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com









From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Doodi, Hari - BLS CTR
Sent: Wednesday, October 26, 2005 10:14 AM
To: 'flexcoders@yahoogroups.com'
Subject: [flexcoders] How to access control attributes inside a repeater

 

 

Hi,

            I would like to know how to access text property of an TextInput control in a Form which is repeated inside a repeater? Here is what I was doing…..

I have two mxml file one department.mxml with repeater tag in it and another deptComp.mxml has form component with TextInput controls.

I was able to display data from the source xml file. I want to know how to set data in to TextInput controls of different instance.

 Also found files are attached for your reference. Any kind of help is appreciated. Thanks in advance.

 

Department.mxml contains……

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*" >

<mx:Model id="deptList" source="Department.xml"/>

<mx:Repeater id="deptRepeater" dataProvider="{deptList.hari}">

      <deptComp deptModel="{deptRepeater.currentItem}" initialize="initialize()"/>   

</mx:Repeater>

</mx:Application>

 

DeptComp.mxml contains………

 

<?xml version="1.0" encoding="utf-8"?>

<mx:VBox xmlns:mx="http://www.macromedia.com/2003/mxml">

<mx:Script>

import mx.controls.Alert;

<![CDATA[                    

            function accessData( ) // display/set data from/to other instance

            {

                // I tried diff possible ways to access text property of TextInput control, deptName, but unable to display content.

              // None of the following Alert display text content.

                        Alert.show(this.parent.deptForm[1].deptName.text,"1");

                        Alert.show(this.parent.deptForm.deptName[1].text,"2");

                        Alert.show(this.deptForm[1].deptName.text,"3");                                      

                        Alert.show(this.deptName[1].text,"4");

                        Alert.show(deptName[1].text,"5");

                        Alert.show(deptForm[1].deptName.text,"6");

                        Alert.show(parent.deptName[1].text,"7");

                        Alert.show(this.parent.deptComp[1].deptForm.deptName.text,"8");

            }

]]>

</mx:Script>

 

    <mx:Model id="deptModel">

                        <deptNum></ deptNum >

                        <deptDesc></deptDesc>

                        <employees />             

    </mx:Model>

 

    <mx:Form id="deptForm" >

        <mx:FormItem >

               <mx:Button label="Click me" click=" accessData ()"/>

         </mx:FormItem>

        <mx:FormItem label="Dept ID:" >

            <mx:TextInput id="deptId" text="{deptModel. deptNum }" width="200"/>

        </mx:FormItem>

        <mx:FormItem label="Dept Name:" >

            <mx:TextInput id="deptName" text="{deptModel. deptDesc}" width="200" />

        </mx:FormItem>               

        <mx:FormItem label="Employees:" >

           <mx:DataGrid id="employee_dg" dataProvider="{deptModel.employees.employee}" />

        </mx:FormItem>

</mx:Form>

<mx:HRule width="668" height="20" />

</mx:VBox>

 

Thanks!
Hari

 


NOTICE:

This message is for the designated recipient only and may contain privileged or confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of this e-mail by you is prohibited.



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to