laravel-fullcalendar
laravel-fullcalendar copied to clipboard
Replace click action for custom buttons with non-JSON encoded values
When trying to set customButtons (http://fullcalendar.io/docs/display/customButtons/) via the options array the click button didn’t work cause it was JSON-encoded. This code replaces the JSON encoded version with the original code that was provided in the options array.
Please merge this PR, I've got the same "problem".
I tried this but didn't show the button, any example? Thanks so much
Here's the example! First - use coupej's patch in composer.json:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/coupej/laravel-fullcalendar"
}
],
"require": {
"maddhatter/laravel-fullcalendar": "dev-master",
}
After "composer update", replaceClickCustomButtons should be found in Calendar.php. If thats successful, update your calendar options:
$calendar = \Calendar::setOptions([
'firstDay' => 1,
'events' => '/calendar/events',
'defaultView' => 'month',
'weekNumbers' => true,
'weekNumbersWithinDays' => true,
'locale' => 'de',
'themeSystem' => 'bootstrap4',
'selectable' => true,
'header' => [
'left' => 'prev,next today B1',
],
'customButtons' => [
'B1' => [
'text' => 'button1',
'click' => 'function () { alert("clicked button1"); }'
],
]
])
¡Thank you very much! I has this exact same problem I couldn't find a workaround. ¡Thanks!