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

Replace click action for custom buttons with non-JSON encoded values

Open coupej opened this issue 9 years ago • 4 comments
trafficstars

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.

coupej avatar Feb 08 '16 00:02 coupej

Please merge this PR, I've got the same "problem".

TimoStahl avatar Apr 12 '16 11:04 TimoStahl

I tried this but didn't show the button, any example? Thanks so much

poxxac avatar Jan 07 '18 20:01 poxxac

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

ghost avatar May 11 '18 12:05 ghost

¡Thank you very much! I has this exact same problem I couldn't find a workaround. ¡Thanks!

SidAliCrenier avatar May 20 '18 15:05 SidAliCrenier