I'm really new in Javascript and Fullcalendar and I need to know how to pass the event id of the clicked event (event_id) to the views.py. so for now I'm having that:
document.addEventListener('DOMContentLoaded', function () {
var calendarUI = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarUI, {
eventClick: function (info) {
alert('Event: ' + info.event.id);
var event_id = info.event.id;
$('#exampleModalToggle').modal('show');}
selectable: true,
editable: true,
displayEventTime: true,
displayEventEnd: true,
contentHeight: "auto",
allDaySlot: false,
initialView: 'timeGridWeek',
headerToolbar: {
left: 'today',
center: 'prev title next',
right: 'dayGridMonth timeGridWeek'
},
views: {
timeGridWeek: {
//titleFormat: { year: 'numeric', month: '2-digit', day: '2-digit' }
columnHeaderFormat: { weekday: 'numeric', month: 'numeric', day: 'numeric', omitCommas: true }
}
},
//slotLabelFormat: [{ month: 'long', year: 'numeric' }, { weekday: 'short' }],
//slotLabelFormat: ['ddd D/M', 'H:mm'],
events: [
]
});
calendar.render();
calendar.setOption('locale', 'fr')
});I tried using Ajax but I'm getting an error, I'm not sure that it could works inside the eventClick,
Could you help me to solve this, please ! I will really appreciate your help :)
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment