我有一个下拉列表为:

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

现在,RefPatientResponselists返回3行数据,我需要在下拉列表中显示3个值。因此,我的标签函数为:

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

但这仅在下拉列表中显示1个值。因此,它返回了类似的东西:

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

如何在下拉列表中获得所有3个值。希望我的问题是可以理解的,并期望得到答复。

谢谢

哈里什

日志中的对象结构:

(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
有帮助吗?

解决方案 2

好的,我能够使用

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

也许对有类似问题的其他人有帮助:)

其他提示

我不清楚您的问题是否是您的下拉列表只有一个项目或下拉列表中的所有项目都显示相同的文本;但是我写了这个答案,假设前者。

您是否处于调试模式?被称为劳力几次?我认为在这种情况下,劳力是红鲱鱼。如果列表仅显示单个项目,则很可能是因为它认为数据Provider只有一个项目。

如果您有一个带有三个项目的datapRovider,则应将其调用3次。每个项目都调用一次。

通常,如果我不绑定到多个对象,我的绑定经验最一致。所以,你没关系:

model.referenceList

或这个

referenceList.refPatientResponseLists

但是,我不希望这能起作用:

model.referenceList.refPatientResponseLists

因此,我的问题是,您确定在DataProvider中返回三个项目吗?您确定该组件知道您的DataProvider中有三个项目(又称绑定正正确更新)?

在不知道您的对象结构的情况下,很难调试您的LabElfunction,但是您不需要使用GetItemindex函数。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top