Skip to content

Miscellaneous

renderWith()

renderWith() — returns any

Instructs the controller to render the data passed in to the format that is requested. If the format requested is json or xml, CFWheels will transform the data into that format automatically. For other formats (or to override the automatic formatting), you can also create a view template in this format: nameofaction.xml.cfm, nameofaction.json.cfm, nameofaction.pdf.cfm, etc.

NameTypeRequiredDefaultDescription
dataanyyesData to format and render.
controllerstringyesSee documentation for renderPage.
actionstringyesSee documentation for renderPage.
templatestringyesSee documentation for renderPage.
layoutanyyesSee documentation for renderPage.
cacheanyyesSee documentation for renderPage.
returnAsstringyesSee documentation for renderPage.
hideDebugInformationbooleanyesfalseSee documentation for renderPage.
// This will provide the formats defined in the `init()` function
products = model("product").findAll();
renderWith(products);