Ask a Jedi: CFGRID Question and Asynchronous Processes in ColdFusion

I’ve got a deal for you today - two questions answered in one entry! The first question is:

Is there anyway to disable the count feature on a cfgrid so the column doesn't show up?

Yes, there is, although for some reason the attribute name just doesn’t seem obvious to me. Anyway, to disable the row counter, all you need to do is add rowHeaders=false to your cfgrid tag. Here is a complete example.

<cfset data = queryNew("id,name,age")>

<cfloop index=”x” from=”1” to=”10”> <cfset queryAddRow(data)> <cfset querySetCell(data,”id”,x)> <cfset querySetCell(data,”name”,”User #x#”)> <cfset querySetCell(data,”age”,randRange(20,90))> </cfloop>

<cfform format=”flash”> <cfgrid name=”data” query=”data” rowheaders=false /> </cfform> </code>

This is one of the features that, for some reason, I always have to look up. Now for the next question:

Is there a way to do an asynchronous process in CFMX? For example, let's say i have a method that spits back XML and then logs a whole bunch of stuff. I'd like it to hand the XML back and then do the logging (this way the requestor doesn't have to wait for the whole log process to finish).

Actually, this is one of the biggest new features added in ColdFusion MX 7. The Event Gateways allow for this now. It is a rather large topic, so I suggest reading the docs on Event Gateways. I then suggest you go to Sean Corfield’s blog and search for “asynch”. You will find many posts and example code that will get you started.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments