laravel-fullcalendar
laravel-fullcalendar copied to clipboard
Open Modal when click on an event
Hi, i would like to show a modal with all the details of an event when i click on him in the calendar, how could i do that ? thanks.
You need to define the click event on the setCallbacks
array. Like this:
$calendar = \Calendar::addEvents($events) //add an array with addEvents
->addEvent($eloquentEvent, [ //set custom color fo this event
'color' => '#800',
])->setOptions([ //set fullcalendar options
'firstDay' => 1
])->setCallbacks([ //set fullcalendar callback options (will not be JSON encoded)
'eventClick' => 'function() {
showModal();
}'
]);
showModal() is a javascript function right?
Yes, you need call modal box into a this function
Hi, i don't get how you ask the showModal() to open the modal ? i don't understand how this function works... Can you explain a bit ? Thx
showModal()
is only an example to showcase how you would call a Javascript function.
Another example:
setCallbacks([
'eventClick' => 'function() {
console.log("You clicked on an event!");
}'
])
eventClick
is a Javascript event handler.