Quantcast
Channel: Adobe Community : All Content - ColdFusion
Viewing all articles
Browse latest Browse all 5979

cfcomponent extends question

$
0
0

Hi all,

i have two cfc' components usind extends as:

<!--- myParent.cfc --->

<cfcomponent displayname="myParent" output="false">

    <cfscript>

         this.myData = '';

    </cfscript>

 

    <cffunction access="remote" name="setQueryData" output="false" >

         <cfquery name="this.myData" datasource="#myDatasource#">

            SELECT *

            FROM myTable

        </cfquery>

    </cffunction>

</cfcomponent>

 

<!--- myExtend.cfc --->

<cfcomponent extends="myParent">

     <cffunction access="remote" name="getData" output="false" >

         <cfquery name="qryData" datasource="#myDatasource#">

            SELECT *

            FROM this.myData

        </cfquery>

 

     <cfreturn qryData />

    </cffunction>

</cfcomponent>

 

<!--- myTest.cfm --->

<cfset myObj = CreateObject("component", "cfcs.myParent") />

<cfset myObj.setQueryData() />

<cfset mySecondObj = CreateObject("component", "cfcs.myChild") />

<cfset finalData = mySecondObj.getData() />

<cfdump var="#finalData#">

 

this.myData is available in the child cfc component but it doesn't show any data.

Can I access data between components?

Thanks


Viewing all articles
Browse latest Browse all 5979

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>