Ariel
Ariel

Reputation: 33

Hiding Events without a Description in FullCalendar + Google Calendar

I am using FullCalendar 2.3.1 and a Google Calendar feed.

I know you can set portions of eventRender to show/hide specific portions of the event that aren't shown at default (such as adding in the Event Description on an event). I was wondering if it were possible to use a callback to function as "if there is no event.description, then do not show the event."

This is the piece of code I used for adding in event.location and event.description to the event blocks when on agendaDay view:

eventRender: function(event, element, view) { 
            	if (view.name === "agendaDay"){
            		element.find('.fc-title').append(
			"<br/><b>Location: </b>" + event.location,
            			"<br/><b>Details: </b>" + event.description);
            			}
        	}

And it works great, so is there a modification of this kind of function that can be done to hide events that don't currently have anything in the event.description field?

All help is greatly appreciated!!

Upvotes: 2

Views: 1184

Answers (1)

A1rPun
A1rPun

Reputation: 16837

From the docs:

The function can also return false to completely cancel the rendering of the event.

So you can do something like this

eventRender: function(event, element, view) {
    if (!event.description) return false;
}

Upvotes: 1

Related Questions