funaroma
unread,Jul 26, 2010, 8:06:25 AM7/26/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ColdFusion on Wheels
what if I want to just store the output from a partial into a
variable, instead of actually having it actually rendered?
Use case;
I use a response object to pass back information via AJAX. this
response object allows me to respond to AJAX requests in a unified
fashion, passing back:
1. An event response string, like "getArticle:success" or
"getArticle:notFound",
2. One or more data items, inside a struct, (addData) and
3. One or more HTML strings, inside a struct (addHtml).
So in my controller, I have an if isAjax() block and inside that block
I instantiate my response object, set it's event response string, use
addData() and/or addHtml() to add any additional items that could be
useful in the client-side ajax handler, and then serialize the entire
object to JSON.
In the particular controller call I'm working with, I need to store
the HTML result of a partial into a variable so I can pass it back via
AJAX, long with other info, in my response object.
However when I do this:
htmlRecentDiscussions = renderPartial(partial="recentDiscussions",
rsRecentDiscussions="#rsRecentDiscussions#");
and make a standard call to my page (non-ajax) I don't get the html
stored in my variable; instead, it renders the partial without the
surrounding page layout.
Is there a way to do what I want?