Advertisement

10.09.2008 at 01:40AM PDT, ID: 23800201 | Points: 500
[x]
Attachment Details

Could I initialize a CFC with data before binding a grid to it?

Asked by BidanZhu in ColdFusion Application Server

Tags:

I am refactoring some very old ColdFusion code (ColdFusion 5, not done by me), and I'm considering replacing a huge and complex HTML table with a CFGrid.

This HTML table is in an INCLUDE file and called from two places, each time it gets a CFQuery with the same name and columns, so the HTML table loop over it, but the (very complex) Queries are built differently.

It would be a major hassle to "open up" the original queries and build them into the CFC that should supply the data for my CFGrid, so my idea is to wrap the original query into a QoQ, and use the QoQ to display and maybe filter the CFGrid.

But my problem is, the CFC that I use to bind to the CFGrid has to somehow get the original CFQuery to base the QOQ upon, and I haven't found any way to pass the CFQuery to it! I tried to pass the CFQuery itself in the bind expression as:
<cfgrid format="html" name="gridTravel" pagesize=25
sort=true autoWidth=false
height="565"
colheaderbold="false" colheaderfont="Franklin Gothic Medium" colheaderfontsize="16"
selectcolor="##b8ccfa" selectOnLoad=false
striperows=true
font="Arial" fontsize="12"
"cfc:travel.getTravelList({cfgridpage},{cfgridpagesize}, {cfgridsortcolumn},{cfgridsortdirection},#TravelQuery# )">

And I also tried to first initialize the CFC with the CFQuery before the binding:
<cfscript>
travelCfc = createObject("component", "travel");
travelCfc.travelListBase = TravelSel;
</cfscript>

But nothing works.

My question, does the binding of CFGrid to a CFC only works in a "static" way (in Java term)?! In that case, the initialization method would clearly never work properly, is it then possible to pass the CFQuery in the Bind at all?

Given my requirement, what would be the best way of achieving what I'm doing?

Any suggestion will be appreciated, and many thanks in advance.

BillyStart Free Trial
 
Loading Advertisement...
 
[+][-]10.24.2008 at 06:48AM PDT, ID: 22796113

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 - Hierarchy / EE_QW_2_20070628