2012-08-26 2 views
0

난`을 결합하고,이 목록 선택에 대한 데이터를 결합하려고, (아래 코드 참조) : 무엇을 달성 할 싶습니다플렉스 플렉스 새로운 목록의 selectedItem

<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> 

은 당신이 데이터를 선택하면 "reIndustry"를 선택하면 선택한 항목의 더 많은 데이터가 "reQualifications"목록에 표시됩니다. 내가 두 번째 목록 "reQualifications"에 표시에 대한 더 많은 값을 추가 할 수있는 방법

<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> 

가능한 경우 :

여기 내 데이터입니다.

+1

그러나 업계 당 하나의 자격이있다 -을 :

당신은 코드 아래를하여 할 수 있습니다. 왜 그것을리스트에서 표현해야합니까? – RIAstar

답변

0

@RIAstar 질문이 맞습니다.

<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"/>