laravel-fullcalendar
laravel-fullcalendar copied to clipboard
Custom button click option not working - Laravel 5.6
Hi,
I've added a custom button option on my laravel controller. It successfully displays the custom button but when I click it, it doesn't work & I got an error on my browser console log.
Error on console log:
fullcalendar.min.js:11 Uncaught TypeError: l.click.call is not a function
at g (fullcalendar.min.js:11)
My code:
$calendar = \Calendar::addEvents($eventsCollections) //add an array with addEvents
->setOptions([ //set fullcalendar options
'firstDay' => 1,
'themeSystem' => 'bootstrap4',
'bootstrapFontAwesome' => false,
'customButtons' => [
'myCustomButton' => [
'text' => 'custom!',
'click' => 'function() { alert("clicked the custom button!");}'
]
],
'header' => [
'left' => 'prev,next today myCustomButton',
'center' => 'title',
'right' => 'month,agendaWeek,agendaDay'
]
])->setCallbacks([ //set fullcalendar callback options (will not be JSON encoded)
//'viewRender' => 'function() {alert("Callbacks!");}'
]);
What could be the reason for it? or am I doing it wrong?
I'm still learning so any help would be appreciated :)
thanks
Hey, did you solve the problem ?
Hi @Juuuke ,
Nope haven't found the solution for it.
Hi @Juuuke, look at the classes of the buttons and add own jquery-Calls for it. e.g.:
$('.fc-myCustomButton-button').click( function() { alert('clicked'); });
Its based on this problem https://github.com/maddhatter/laravel-fullcalendar/pull/35