Render partial or multiple views in single event.

I have ran accross a problem that I havent been able to find a
solution for, not a clear one anyways.

Is it possible to render multiple views (partials) in a single event?


I have an event handler method like this:

  <cffunction name="overview" access="public" returntype="void"
    <cfargument name="Event" type="coldbox.system.beans.requestContext">
    <cfset var rc = event.getCollection()>
    <cfset Event.setValue("pageTitle","Dashboard")>
    <cfset rc.xehAddProject = "Project.dspAddProject">
    <cfset runEvent('tickets.myRecentTickets')>
    <cfset runEvent('dashboard.overview')>

Both of these Events have their own views that contain basically just
list code. However when I run this event, only the last event gets
rendered. Is there a way to allow both events to fire and be rendered
in place during the execution or can you only run a single view in an

Sorry if this has been addressed before, I havent been able to find a
clear answer.

Russ Johnson

Hi Russ,

I believe you are refering to content variables. You can use the renderer plugin to render views and place them into content variables. Below is a sample example I have used often:

//Execute an event runEvent("tickets.dspEvents"); //Render the set view by the event ticketsContent = getPlugin("renderer").renderView();

The renderer can be used to render views directly also:

<cfset myView = getplugin(“renderer”).renderView(“mytickets”)>

So there are several ways you can do this via the renderer plugin. Remember that the events, prepare the views, then you use the plugin to render them.

Hope this helps.


thanks luis! thats exactly what i was looking for!