Search code examples
apache-flexdrop-down-menulabelfunction

Flex DropDownList LabelFunction Issue


I have a dropdown list as :

    <s:DropDownList id="cad" width="100%" dataProvider="{model.referenceList.refPatientResponseLists}" 
labelFunction="myFunction"                              selectedIndex="{model.cd.code}"/>

Now the refPatientResponseLists returns 3 rows of data & I need to display the 3 values in the Dropdownlist. So I have the label function as :

    public function myFunction(item:Object):String {
     return item['refPatientResponses'] [cad.dataProvider.getItemIndex(item)]['responseDesc']+''; 
}

But this displays only 1 value in the Dropdownlist. So it returns something like:

return item['refPatientResponses'] [0] ['responseDesc']+'' 

How can I get all the 3 values in the dropdown. Hope my question is understandable and expecting a reply.

Thanks

Harish

Object structure from the logs:

(Typed Object #1 'datacollection.model.ReferenceList')
    (Array #3)
    refPatientResponseLists = (Externalizable Object #4 'flex.messaging.io.ArrayCollection')
      (Array #5)
        [0] = (Typed Object #6 'datacollection.model.RefPatientResponseList')
          refPatientResponses = (Externalizable Object #7 'flex.messaging.io.ArrayCollection')
            (Array #8)
              [0] = (Typed Object #9 'datacollection.model.RefPatientResponse')
                responseSequence = 1
                responseDesc = "No"
                responseCode = 28
                responseTypeCode = 10
              [1] = (Typed Object #10 'datacollection.model.RefPatientResponse')
                responseSequence = 2
                responseDesc = "Yes"
                responseCode = 29
                responseTypeCode = 10
              [2] = (Typed Object #11 'datacollection.model.RefPatientResponse')
                responseSequence = 3
                responseDesc = "Claim Not Found"
                responseCode = 30
                responseTypeCode = 10

Solution

  • Ok I was able to solve it using

    Model.referenceList.refPatientResponseLists.getItemAt(0).refPatientResponses
    

    Maybe helpful for others who have similar issues :)