Flex binding List selectedItem

I`m new with flex, and trying to combine data for 2 List selections, (SEE CODE BELOW):

<s:Label x="538" y="130" text="Industry of Interest:"/>
        <s:List id="reIndustry" x="538" y="150" width="165" height="122" dataProvider="{recruitIndustries}" labelField="industry"></s:List>
        <s:Label x="723" y="130" text="Qualifications:"/>
        <s:List id="reQualifications" x="723" y="150" width="165" height="122" selectedItem="reIndustry.selectedItem.qualification" labelField="qualification"></s:List>

What i would like to accomplish is that when you select data from "reIndustry", more data of the selected item will then show in "reQualifications" List.

Here is my Data:

 <s:ArrayList id="recruitIndustries">
        <fx:Object industry="Admin/PA/Secretary" qualification="Other"/>
        <fx:Object industry="Automotive" qualification="Painter"/>
        <fx:Object industry="Building/Construct/Mine"/>
        <fx:Object industry="Engineering"/>
        <fx:Object industry="Finance/Accounting"/>
        <fx:Object industry="FMCG"/>
        <fx:Object industry="General Employment"/>
        <fx:Object industry="Health and Skincare"/>
        <fx:Object industry="Insurance"/>
        <fx:Object industry="International"/>
        <fx:Object industry="IT/Computer"/>
        <fx:Object industry="Legal"/>
        <fx:Object industry="Logistics"/>
        <fx:Object industry="Management"/>
        <fx:Object industry="Manufacturing"/>
        <fx:Object industry="Medical"/>
        <fx:Object industry="Part Time/ Temps"/>
        <fx:Object industry="Professions"/>
        <fx:Object industry="Retail"/>
        <fx:Object industry="Sales and Marketing"/>
        <fx:Object industry="Tourism/Hospitality"/>
    </s:ArrayList>

If possible, how can I add more values for showing in the second List "reQualifications".

Answers


@RIAstar question is Correct.

You can do it by below code:-

<fx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;

            import spark.events.IndexChangeEvent;

            [Bindable]
            private var moreDataProvider:ArrayCollection = new ArrayCollection();
            private function itemClickHandler(event:IndexChangeEvent):void
            {
                moreDataProvider.removeAll();
                if(Object(reIndustry.selectedItem).hasOwnProperty('qualification'))
                    moreDataProvider.addItem(reIndustry.selectedItem);
            }
        ]]>
    </fx:Script>
    <s:layout>
        <s:VerticalLayout/>
    </s:layout>

    <s:Label x="538" y="130" text="Industry of Interest:"/>
    <s:List id="reIndustry" dataProvider="{recruitIndustries}" x="538" y="150" width="165" height="122" 
            labelField="industry" change="itemClickHandler(event)"/>
    <s:Label x="723" y="130" text="Qualifications:"/>
    <s:List id="reQualifications" dataProvider="{moreDataProvider}" x="723" y="150" width="165" height="122" 
            labelField="qualification"/>

Need Your Help

Update one table where record found in another table

php mysql table

I am really struggling on how to achieve this and hope that someone can help me. I have the existing function and query:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.