Return to v1.4.5 docs

renderWith()



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.

Name Type Required Default Description
data any Yes Data to format and render.
controller string No See documentation for renderPage.
action string No See documentation for renderPage.
template string No See documentation for renderPage.
layout any No See documentation for renderPage.
cache any No See documentation for renderPage.
returnAs string No See documentation for renderPage.
hideDebugInformation boolean No false See documentation for renderPage.
// This will provide the formats defined in the `init()` function
products = model("product").findAll();
renderWith(products);