Ask a Jedi: Two CFGRID Questions

This post is more than 2 years old.

Joel asks:

I have problems with using CFGRID and hope you can help. Here are my issues:

  1. When sorting the 2nd and 3rd columns sort ok, the first causes an error stating an "Error in executing the Query".

This is actually not a CFGRID issue, but an issue with your data provider, which is most likely a CFC. You need to debug why your CFC is throwing an error. This can be done multiple ways. The easiest is to use Firebug - not the request throwing the error, and open the request in a new tab. You will see more information about the error.

2. And is there a way to prevent the columns from being moved?

Well, I'm not sure why you would want to block that, but if you get access to underlying grid object (using ColdFusion.Grid.getGridObject(), you should be able to use the Grid api to disable this behavior. You may have to look up the Grid docs at Ext first though. (And yes, I'm being lazy, but I figure telling you where to look is a bit helpful. :)

Now let me assume my Stan "I think I've learned something" pose: This blog entry speaks to two topics I've covered a few times before, and I really think it touches on folks who are just now getting into Ajax stuff because of ColdFusion. It is critical you get that:

a) Learn to debug. Tools like Firebug are critical for figuring out what went wrong with an Ajax-based request. You must - I repeat, must get familiar with this as it will make your life much easier to handle.

b) Remember that the Ajax tools that ColdFusion 8 uses are all based on third party tools. You can (and should) go to those sites - read the docs - and get familiar with them if you want to go "beyond the basics" in terms of how you use them within ColdFusion.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, 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

Archived Comments

Comment 1 by Michael Appenzellar posted on 7/7/2010 at 4:58 PM

Is there anyway to bind to a CFC so that you can allow sorting but ALSO utilize the groupfield attribute? I get an error but it seems like there must be a way.

Comment 2 by Raymond Camden posted on 7/7/2010 at 5:03 PM

As far as I know - no.

Comment 3 by Michael Appenzellar posted on 7/7/2010 at 5:06 PM

Wow, am I crazy to think that seems like such a simple thing? Is there any way to trick a grid to display it like the groupfield does?

Comment 4 by Raymond Camden posted on 7/7/2010 at 5:13 PM

If I understand right, groupfield applies to a cfquery. When you bind, you still work with queries, but they are pretty different (loaded over the wire, with paging info). In fact, the paging would make grouping kinda difficult.

Comment 5 by Michael Appenzellar posted on 7/7/2010 at 5:42 PM

Just as an FYI, after hours of searching, this seems to be what I need! http://brianflove.com/publi... - http://blog.brianflove.com/...

Comment 6 by Rich Hefter posted on 5/12/2011 at 2:35 AM

Was this solved (1st question) - I am having the same problem.

Comment 7 by Raymond Camden posted on 5/12/2011 at 4:34 PM

Not that I know of.