Philip Stratford
Philip Stratford

Reputation: 4733

Display Resource Name in Event

I'm trying out the new Scheduler add-on for FullCalendar. I've got it all working great, but I hoped there'd be a property I could add to an Event object so that it would display the name of the Resource it's associated with as well as the Title, but there doesn't seem to be. Is there a way in which this could be done?

The goal is for Events displayed in a standard calendar view (e.g. agendaWeek) to show the time and Title (as they do now) as well as the Resource Name.

Upvotes: 0

Views: 1235

Answers (1)

DanielST
DanielST

Reputation: 14133

Easy enough to do with the eventRender callback.

eventRender:function( event, element, view ) {
    $(element).find(".fc-content").append("<div>"+event.resourceId+"</div>");
}

JSFiddle

If you want, say the title of the resource instead of the ID, use the getResourceById method too.

eventRender:function( event, element, view ) {
    var resource = $("#calendar").fullCalendar("getResourceById","1");
    $(element).find(".fc-content").append("<div>"+resource.title+"</div>");
}

JSFiddle

Upvotes: 1

Related Questions