I swear this is something I may have covered before, but I'm not finding it in my archives. Either way, it's a good tip and I wanted to share it. Markus Wollny was working with a CFDIV tag that was bound to a CFC:
<cfdiv id="ivactid" bind="cfc:article.getCuriVactid()"></cfdiv>
The problem he ran into was refreshing the data in the grid. Normally a bound CFDIV (or other UI item) would 'listen' in to a particular form field and notice when it changed. In his case, there was no form field included in the bind.
To get around this, he simply used ColdFusion.navigate on the DIV and switched to a URL version of his CFC:
ColdFusion.navigate('article.cfc?method=getCuriVactid','ivactid')
In order for this to work the CFC has to return a string as a result, and unless the cffunction tag declares it explicitly, you will need to use a returnFormat of plain:
ColdFusion.navigate('article.cfc?method=getCuriVactid&returnFormat=plain','ivactid')
Thanks for sharing this, Markus.
Archived Comments
Cool trick guys - thanks for posting it.
Similar to this post: http://www.coldfusionjedi.c...
Great tip!!!
I have a question, assume I have a countdown timer, and I wanted to make a function where it would automatically stop or update the count down to all users who are viewing it whether or not they refresh the page or not. I guess you can say this would be similar to swoopo.com and how there bidding works.
You would have to use an Application variable to ensure that everyone sees the same value. If you wanted the ability to stop it you would need some control for that, probably in your admin.
I haven't seen that syntax for calling CFC methods. How would you pass an argument to getCurVactid()?
Which syntax exactly?