Hey guys!
I am using Fullcalendar to manage an event agenda. I want to implement a modal that shows information when you click on a specific event.
To do this, I was thinking about ReactiveDict. I could use the “eventClick” hook on Template.Calendar.onRendered( ) to create the ReactiveDict, set it with all the data and then create a helper function that sends this data to the modal.
Unfortunately, I have not been able to do so… the modal opens without data and I am getting this error:
Exception in template helper: TypeError: Cannot read property ‘get’ of undefined
Can someone please give me a light on how to do this? Here is my code:
if(Meteor.isClient){
Template.Agenda.onRendered(function(){
$('#eventmodal').modal();
$('#calendar').fullCalendar({
/* a lot of configurations */
eventClick: function(event) {
var state = new ReactiveDict();
state.set({
'id':event._id,
});
$('#eventmodal').modal('open');
},
});
});
Template.Agenda.helpers({
'eventId'(){
const instance = Template.instance();
return instance.state.get('id');
}
})
}
I also tried to change my ReactiveDict call to this.state = ReactiveDict( )
, but no success.