首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Flex: RemoteObject,传递命名参数

Flex: RemoteObject,传递命名参数
EN

Stack Overflow用户
提问于 2010-12-07 04:53:51
回答 1查看 1.3K关注 0票数 1

我使用Flex的ColdFusion方法调用RemoteObject cfc方法。

代码语言:javascript
复制
<fx:Declarations>
    <s:RemoteObject destination="ColdFusion" source="cfc.categoryGateway" id="categoryGateway">
        <s:method name="getCategoryList" result="returnHandler(event)"
                   fault="mx.controls.Alert.show(event.fault.faultString)">
            <s:arguments>
                <orderby>categoryId</orderby>
                <parentCategory>1</parentCategory>
            </s:arguments>
        </s:method>
    </s:RemoteObject>
</fx:Declarations>

当我的cfc以下列方式接受参数时:

代码语言:javascript
复制
<cffunction name="getCategoryList" access="remote" output="false" returntype="query">
    <cfargument name="parentCategory" type="string" required="false" />
    <cfargument name="orderby" type="string" required="false" />
    <!--- code... --->
    <cfreturn qCategoryList />
</cffunction>

因此,您可以看到,在调用cfc方法时,我更改了参数的顺序。但它不起作用。

这意味着<s:arguments>不传递名为的参数。有什么解决办法吗?正如您所看到的,我可能有一些非强制性的参数,因此必须以名称传递。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-12-07 21:04:07

参数是一个数组,所以不管您将每个元素命名为什么,我认为它仍然会按顺序使用它。你可以试着做这样的事情:

代码语言:javascript
复制
<s:RemoteObject destination="ColdFusion" source="cfc.categoryGateway" id="categoryGateway">
        <s:method name="getCategoryList" result="returnHandler(event)"
                  fault="mx.controls.Alert.show(event.fault.faultString)" />
    </s:RemoteObject>

然后打电话:

代码语言:javascript
复制
categoryGateway.getCategoryList({orderby:'categoryId', parentCategory:'1'});
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4373524

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档