【问题标题】:Flex coldfusion and multiple remote objectsFlex Coldfusion 和多个远程对象
【发布时间】:2009-08-21 02:52:08
【问题描述】:

我正在尝试在弹性页面上加载多个表格,但似乎无法弄清楚如何使用多个远程对象。

下面是我的冷融合

<cfcomponent output="false">    
<cffunction name="getVacancies" access="remote" returntype="query">     
    <cfset var = qRead ="" />   
    <cfquery datasource="sqlexpress" name="qRead">      
        SELECT Status, SFIELD6
        FROM dbo.VacantSumm
    </cfquery>
    <cfreturn qRead />  
</cffunction>
<cffunction name="getVacancyTotals" access="remote" returntype="query">
    <cfset  var = vRead =""/>
    <cfquery datasource="sqlexpress" name="vRead">
        select Total, Status
        from dbo.VacancyTotal
    </cfquery>
    <cfreturn vRead />
</cffunction>

现在我的 AS:

import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
            [Bindable]
            private var acVacancies:ArrayCollection;
            private var VacancyTotals:ArrayCollection;


            private function initApp():void
            { 
                VacancyGateway_RO.getVacancies();
                VacancyGateway_RO.getVacancyTotals();

            }
            private function getVacanciesRO_Handler(event:ResultEvent):void
            {
                acVacancies = ArrayCollection(event.result);
            }
            private function getVacancyTotalsRO_Handler(event:ResultEvent):void
            {
                VacancyTotals = ArrayCollection(event.result);
            }

我想我知道我在哪里。这两个数组集合,对此的任何帮助都将非常感激。

【问题讨论】:

    标签: apache-flex datagrid coldfusion


    【解决方案1】:

    您的远程对象定义似乎未包含在上述 AS sn-p 中。您是否在代码的另一部分创建它们?如果是这样,请仅添加该部分,以便我们查看您是如何创建对象的。你没有提到你得到了什么错误,如果有的话;这也将有助于了解。

    另外,我看到您发现您不需要为 CFC 中的每个方法创建单独的 RemoteObject 实例。只要您为每个函数添加一个method 元素,单个实例就适用于所有这些。例如:

     <mx:RemoteObject
        id="VacancyGateway_RO"
        destination="ColdFusion"
        source="wherever.your.CFC.is.located">
    
        <mx:method name="getVacancies" result="getVacanciesRO_Handler(event)"
             fault="mx.controls.Alert.show(event.fault.faultString)"/>
        <mx:method name="getVacancyTotals" result="getVacancyTotalsRO_Handler()"
             fault="mx.controls.Alert.show(event.fault.faultString)"/>
    </mx:RemoteObject>
    

    我之所以提到这一点,是因为我最近参与了一个项目,在该项目中,以前的开发人员为他们调用的每个方法都创建了一个 RemoteObject……而且在某些 CFC 中有很多方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多