I don't know if I properly understood your post but you don't
really need a CFC to accomplish that. Second, this is the advanced
forum, so this is not the right forum for an issue of this nature.
Again, you didn't really explain why you need a CFC but I will try
to reply to your post in the best of my abilities despite the lack
of details in the information you provided.
First of all, let's talk about CFCs. CFC is a coldfusion
component and in my daily tasks I use CFCs to put together all the
functions I use in the system and to put together some special
functionality that I repeatedly use in my system. There are other
uses depending on your system. What's your scenario? You can call
CFCs by including it in your cfm files through <cfinclude>,
by using <cfinvoke>, or by invoking your CFC in your session
scope (those are the scenarios where I call my CFCs on a daily
basis, this doesn't mean they are the only tecniques allowed.)
But to accomplish what you want to accomplish you need two
functions. Imagine that you created the function getGroups(), and
get GroupMembers()
<html>
<head><title>Example</title></head>
<body>
<cfloop index="idx" from="1"
to="#getGroups.recordcount#">
<cfquery name="getMembersofGroup"
datasource="#application.dsn#" dbtype="query">
select * from groupmembers where
group="#getGroups.groupId[idx]#"
</cfquery>
Group: #getGroups.GroupDesc[idx]#:
<div id="divId_#idx#"
onClick="JSFunctionThatShowandHidesDiv();">
<table>
<cfloop index="ind" from="1"
to="#getMembersofGroup.recordcount#">
<tr>
<td>#groupMembers[ind]#</td>
</tr>
<cfloop>
</table>
</div>
</cfloop>
</body>
</html>
The next step is to create a small javascript function that
hide and show html divs. I don't have time to type it for you,
please research it. Let me give you a hint:
document.getElementById('divId').style.visibility='hidden';
or
document.getElementById('divId').style.visibility='visible';
I hope this helps and like I said, you did not really explain
what you were trying to accomplish with your CFCs.
Have a nice day!
Ysais.