Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
Make fullcalendar event filtering persistant between re-renderings

I have a fullcalendar that initially display all events, but i'm usign a select to filter the events, the filter works well, however when the callendar re-render because I moved to the next month it shows all events again. This is my callendar initialization

var calendarEl = document.getElementById('calendar');
    var calendar = new FullCalendar.Calendar(calendarEl,{
        titleFormat:{
            hour12: true
        },
        locale: '{{ (App::getLocale() == "es") ? "es" : "en" }}',
        bootstrapFontAwesome: false,
        headerToolbar: {
            left: 'prev,next today',
            center: 'title',
            right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
        },
        eventTimeFormat: {
            hour: '2-digit',
            minute: '2-digit',
            hour12: true
        },
        events:"{{ route('schedules.show', 0) }}"
    });

    calendar.render();

And this my calendar filtering:

        $('#select_coach').change(function(){

            var coach_id = $('#select_coach').val();

            source = "{{url('/schedules/show/')}}"+'/'+coach_id;

            events = calendar.getEvents();
            events.forEach(event => { event.remove()});
            calendar.addEventSource(source);

       })
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

With the fullcalendar method getEventSources() I got the original source then I put it in a variable let sources = calendar.getEventSources(); then I called the remove() method on the variable now I only have one source so everytime it re-render only use the last source.

let events = calendar.getEvents();
events.forEach(event => { event.remove()});
let sources = calendar.getEventSources();
sources[0].remove();
calendar.addEventSource(source);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!