Cairngorm 2 & ColdFusion Master/Detail Example

There are some excellent Cairngorm 2 examples on the web but none that really covered the Flash Remoting and the Master/Detail “bean” created when you use the ColdFusion/Flex Application Wizard in Flex Builder 2.    I wanted to create a very simple example that basically used the same ColdFusion components (CFC) created when you use the ColdFusion Application Wizard.   I received some really good advice and encouragement from Tim Hoff on as well as examples from the community.  

Jesse Warden (Jexter) posted an example using Flex 2 Webservices and Cairngorm 2.   Benoit Hediard’s posted a PhoneExample application that used Flash Remoting.   Alex Uhlmann has several good examples that show you how to use change the state of your application with Cairngorm 2.  Of course the ultimate example is the CairngormStore example posted on Adobe Lab’s along with the series of articles  by Steven Webster of Adobe Consulting and the store example code posted by Andy Rayne.  

The example is simple and the implementation could probably be changed a bit.  For example, the current example passes an Value Object to the detail view.  When the detail view updates, it also updates the reference of the Value Object in the VO array at the same time (DataGrid in the Master view).    I also dispatch an event when any VO object is successfully updated to refresh my Master view. I suspect that I would just work directly with the array of VO’s directly.  However, the examples I have reviewed all have little differences, this may be just to due to preference.  Maybe one day I can discuss this directly with someone from Adobe Consulting, to really understand the best practices when using the Cairngorm framework.

I will say this, the time it took to go from idea to final product (although very basic) was simple when you use the framework. I could see how the Cairngorm architecture can really speed up development time and also make a solid and scalable structure for your application.  

Update:

Benoit Hediard wrote on FlexCoders:

Concerning this issue, our best practice is to implement a clone() method to all the VO classes. In the command that open the popup, you clone the VO in order to eliminate any binding references. When the cloned VO is updated (or when the updated VO is returned by the server), you could update the collection referenced as a dataprovider instead of refreshing the entire master list (but only if you use an ArrayCollection, if you use a simple Array, your bindings won’t be updated).

I have updated the example to reflect Benoit’s suggestions, everything is working great now!

9 Comments

  1. Surprised nobody commented on this yet. Thanks for contributing this. It answered a lot of questions for me!

  2. thanks! This is perfect as we’re using coldfusion in our production system and all of the documentation I’ve seen use AMFPHP. Thanks a bunch!

  3. I ran across this example a while back but didn’t have time to delve into it. I started today and was able in a couple of hours to have everything working perfectly running on my pc. Thanks. This is a big help.

  4. Thank you, thank you, thank you! Why did it take me so long to find this post? This is exactly the type of example I needed – Flex, Cairngorm and ColdFusion hitting a database – I’m surprised that I haven’t been able to find anything similar sooner, and that the Adobe Cairngorm Store wasn’t set up as a CRUD application.

  5. Thanks Mister – I have definitely been a fan of asfusion.com for years, but this time I was specifically looking for Cairngorm (with Flex and ColdFusion) applications that hit the database, and on asfusion, I only came across a “helloworld” Cairngorm example on that site.

Comments are closed.