I am currently in the process of rewriting a rather large spagetti code application to use FW/1 and ColdSpring. While its a relief to finally start bringing this beast into the 21st century its not without its challenges.
One of the problems I encountered is that the old application makes extensive use of component binding for different cfui components such as cfgrid. Unfortunately converting to a third party grid plugin such as datatables is not possible at this point in time due to the way the application is coded (don't ask).
This means that as I convert each component from being invoked transiently to being persisted in memory I have to create proxies for any remote methods used for the cfgrid bindings.
Now ColdSpring has the ability to create proxies for this specific purpose using the RemoteFactoryBean. If you are interested here is a good article on how to Configure ColdSpring Remoting.
Personally though I prefer to manually create my remote proxy components and its actually very easy.
What we need to do is first refactor our existing code from a standalone component to a service component. Then we create the proxy component that the cfgrid can bind to which can in turn call the service component.
Aside: This may seem like a lot of unnecessary work and if the end goal was to continue to use cfgrid in the application you would be right. However the reason for doing this is as an intermediary step to allow the application to continue to use cfgrid while being refactored into FW/1 and eventually switching to a different datagrid plugin.
To demonstrate lets take a users cfgrid which is bound to a component "users.cfc" method "getUsersForGrid" in a directory "/components/".
SELECT
userId
, username
, dob
, email
FROM
users
WHERE
username LIKE
Note: You will of course notice that this uses the ColdFusion function QueryConvertForGrid(). Please don't do this, it's really very very bad practice. Instead you should use database pagination.
First lets create the service cfc based off the existing users.cfc file and place it in our "/model/services/" folder.
SELECT
userId
, username
, dob
, email
FROM
users
WHERE
username LIKE
As you can see all we did was copy the file and change the access attribute from remote to public.
With the service function created we now strip out the logic from the old "/components/users.cfc" file and replace it with a call to the users service after first getting a reference to the service using the FW/1 bean factory getBean() function.
With these changes the cfgrid will continue to function as normal but our main logic is now encapsulated in our model service layer ready for further refactoring.