laravel-fullcalendar icon indicating copy to clipboard operation
laravel-fullcalendar copied to clipboard

Open Modal when click on an event

Open Rostom22 opened this issue 7 years ago • 5 comments

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.

Rostom22 avatar May 15 '17 22:05 Rostom22

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();
         }'
    ]); 

cesarureno avatar Jun 12 '17 21:06 cesarureno

showModal() is a javascript function right?

vikdb avatar Oct 14 '17 13:10 vikdb

Yes, you need call modal box into a this function

cesarureno avatar Oct 16 '17 01:10 cesarureno

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

LucasR33 avatar Feb 08 '18 11:02 LucasR33

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.

seandelaney avatar Feb 14 '18 18:02 seandelaney