Is there a way to get a data that I passed to eventObj when user clicks on background event? My sample background event looks like this:
{
id: 'availableForMeeting',
title: 'Test Background Event #1',
start: '2015-08-13T07:30:00',
end: '2015-08-13T12:30:00',
rendering: 'background',
sampleId: 214,
color: 'red'
}
But I can't get sampleId field, 'cause it doesn't exist in jsEvent.
First, in order to actually get a click handler on a background event, you have to use a delegated jquery .on() because FullCalendar's eventClick doesn't work for background events.
$("#calendar").on("click",".fc-bgevent",function(event){
console.log($(this).data());
});
With just that, you will get an empty console log. We need to add the event data to the event element. We can do this in eventRender
eventRender: function(event,element,view){
$(element).data(event);
},
Working JSFiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With