Fullcalendar: "Uncaught Syntaxerror: Unexpected token :"

Asked

Viewed 46 times

0

I have a bad headache. My full Calendar was working perfectly, however it stopped working. It accuses the following error: "Uncaught Syntaxerror: Unexpected token :".

Below is the scenario:

<!-- fullcalendar css -->
<link href="{{asset('admin/assets/plugins/fullcalendar/fullcalendar.min.css')}}" rel="stylesheet" type="text/css" />
<!-- fullcalendar print css -->
<link href="{{asset('admin/assets/plugins/fullcalendar/fullcalendar.print.min.css')}}" rel="stylesheet" media='print' type="text/css" />

<script src="{{asset('admin/assets/plugins/fullcalendar/lib/moment.min.js')}}" type="text/javascript"></script>
<script src="{{asset('admin/assets/plugins/fullcalendar/fullcalendar.min.js')}}" type="text/javascript"></script>

Part of fullcalendar:

     var calender = $('#calendar');
        $(calender).fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay,listMonth',
            },
            defaultDate: Date('Y-m-d'),
            navLinks: true, // can click day/week names to navigate views
            businessHours: true, // display business hours
            editable: true,
            droppable: true, // this allows things to be dropped onto the calendar
            lang: 'pt-br',
            drop: function() {
                // is the "remove after drop" checkbox checked?
                if ($('#drop-remove').is(':checked')) {
                    // if so, remove the element from the "Draggable Events" list
                    $(this).remove();
                }
            },
            events: [
                @foreach($causas as $causa)

                    {

                        title: "{{$causa->acao->acao ?? '' }}",
                        start: "{{$causa->prazo ?? '' }}",
                        end:"{{$causa->prazo ?? '' }}",
                        url: "{{route('admin.causas.perfil',['id' => $causa->id]) ?? ''}}",
                        color: "{{$causa->color}} !important",
                        textColor: "#FFFFFF"

                    }, 
                    @endforeach

            ]
        });
    }

Calendar is simply not being printed on the screen... I have already done the conference on the controllers and the data is being sent to view... Someone knows what it could be, it was working normally...

  • I think you want that events as object and not as right array? ie events: {...} instead of events: [...]...

  • I edited the question, I had expressed myself badly and with few details

  • seems kind of simple but, this can give error: right: 'month,agendaWeek,agendaDay,listMonth',, already tried to remove the comma at the end?

  • Within Events I replace ?? ' by ?? 'without action'. It’s working again, but it’s bothering me a lot because I honestly don’t understand the reason why

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.