是否可以使用 Flex 在组合框数据提供程序中使用条件运算符?

发布于 2024-08-13 06:58:17 字数 264 浏览 5 评论 0原文

在我的组合框中,我必须显示基于条件的团队名称。所以我会尝试

dataProvider="{usersXML.users.user.(id=10).name}" 但显示一些错误。但如果我尝试

dataProvider="{usersXML.users.user.name}" 显示所有 name 。它正在工作。

我如何根据条件显示列表。在组合框中。请介绍我。是否可以检查 dataProvider 上的 id 数组?

In my Combo box i have to shows team names condition based . So i will try like

dataProvider="{usersXML.users.user.(id=10).name}" but shows some errors . but if i tried

dataProvider="{usersXML.users.user.name}" display all name . It's working .

How can i condition based to display the list . In combobox . Plz refer me . is it possiable to check array of id on the dataProvider ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

怪异←思 2024-08-20 06:58:17

看起来这更像是一个 E4X 问题,而不是专门与组合框有关的问题。你尝试过吗:

usersXML.users.user.(@id==10).name

It seems like this is more an E4X question than one to do with the Combo box specifically. Did you try:

usersXML.users.user.(@id==10).name
最单纯的乌龟 2024-08-20 06:58:17

我认为你的处理方式是错误的。您是否尝试过存储这样的内容:

[Bindable]
var targetList:XMLList

function setID( id:int ):void
{
    var tmpList:XMLList = usersXML.users.user.( @id==id );

    if( tmpList && tmpList.length() && [email protected]().length )
    {
        targetList = tmpList
    }
}

如果您使用上面的内容来设置 id,那么您可以运行测试以确保在这种情况下用户 ID 和适当的名称属性确实存在。

要使 XML 指向该对象:

<mx:Combobox dataprovider="targetList" />

I think you're going about it the wrong way. Have you tried storing something like this:

[Bindable]
var targetList:XMLList

function setID( id:int ):void
{
    var tmpList:XMLList = usersXML.users.user.( @id==id );

    if( tmpList && tmpList.length() && [email protected]().length )
    {
        targetList = tmpList
    }
}

If you use the above to set the id, then you can run tests to make sure that user ID and the appropriate name attribute definitely exists in this case.

To get the XML to point to this object:

<mx:Combobox dataprovider="targetList" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文